Compare commits
3 Commits
26a1e02a2a
...
0f96139873
Author | SHA1 | Date | |
---|---|---|---|
0f96139873 | |||
6659de5642 | |||
a4b0ecec9c |
@ -13,9 +13,9 @@ In 2021's contest, I got a score of 48/75 in the senior division. [Here's](https
|
|||||||
|
|
||||||
In my free time I do programming projects, some of which have have full articles in my blog.
|
In my free time I do programming projects, some of which have have full articles in my blog.
|
||||||
|
|
||||||
#### [minrss](https://github.com/dogeystamp/minrss)
|
#### [minrss](/minrss)
|
||||||
|
|
||||||
This is a minimal RSS/Atom feed reader I made using C. It relies mostly on libcurl for multi-threaded downloads of RSS feeds, and libxml2 for XML parsing.
|
This is a minimal RSS/Atom feed reader I made using C.
|
||||||
|
|
||||||
The main feature of this program is that it represents feeds as folders with
|
The main feature of this program is that it represents feeds as folders with
|
||||||
articles as files within them.
|
articles as files within them.
|
||||||
@ -31,7 +31,8 @@ rss
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
As such, external scripts - or even a plain shell - can be easily used to read feeds with minrss.
|
As such, minrss has very good compatibility with shell scripting.
|
||||||
|
You could even use basic shell commands to read your RSS feeds.
|
||||||
|
|
||||||
This is similar to suckless.org's programs
|
This is similar to suckless.org's programs
|
||||||
[ii](http://tools.suckless.org/ii/) and [sic](http://tools.suckless.org/sic/).
|
[ii](http://tools.suckless.org/ii/) and [sic](http://tools.suckless.org/sic/).
|
||||||
@ -43,8 +44,8 @@ Encryptme is a web app that provides cryptography tools.
|
|||||||
It aims to be simple and not clutter the interface,
|
It aims to be simple and not clutter the interface,
|
||||||
but it still exposes advanced options if desired.
|
but it still exposes advanced options if desired.
|
||||||
|
|
||||||
Instead of using an established front-end framework, it's based on a module I
|
Instead of using an established front-end framework, it's based on a homebrew
|
||||||
wrote from scratch in JavaScript for creating interfaces.
|
vanilla JavaScript module for drawing interfaces.
|
||||||
|
|
||||||
#### [bitmask](https://github.com/dogeystamp/bitmask)
|
#### [bitmask](https://github.com/dogeystamp/bitmask)
|
||||||
|
|
||||||
|
126
posts/minrss.md
Normal file
126
posts/minrss.md
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
# minrss, a lightweight feed reader
|
||||||
|
|
||||||
|
2023-05-14
|
||||||
|
|
||||||
|
![](/public/img/minrss-mrss.jpg)
|
||||||
|
|
||||||
|
## purpose
|
||||||
|
|
||||||
|
If you want to read content online from many different websites, the best way is to subscribe to RSS or Atom feeds.
|
||||||
|
It's a simple, universal format for getting content onto your screen.
|
||||||
|
|
||||||
|
I personally enjoy living in the terminal.
|
||||||
|
One of the more popular RSS readers for this environment is [Newsboat](https://newsboat.org/).
|
||||||
|
Newsboat has tons of useful features and a pretty TUI, and I did use it for a while.
|
||||||
|
|
||||||
|
However, I thought that it was too complex for what I needed in an RSS reader.
|
||||||
|
Therefore, I decided to write a new one: MinRSS.
|
||||||
|
|
||||||
|
## concept
|
||||||
|
|
||||||
|
MinRSS is a small binary that "does one thing and does it well":
|
||||||
|
it downloads RSS articles to disk.
|
||||||
|
|
||||||
|
Essentially, every feed is represented as a
|
||||||
|
folder, and individual articles are files in these folders.
|
||||||
|
|
||||||
|
Every time the binary is run, it creates a structure like this in the current working
|
||||||
|
directory:
|
||||||
|
|
||||||
|
rss
|
||||||
|
|--news
|
||||||
|
| |--article1
|
||||||
|
| `--article2
|
||||||
|
`--blog
|
||||||
|
|--post
|
||||||
|
`--other_post
|
||||||
|
|
||||||
|
If an article is new (it wasn't on disk already), its filename is printed to standard output.
|
||||||
|
|
||||||
|
The goal of doing things this way is to make writing scripts as easy as possible.
|
||||||
|
If you're familiar with shell scripting, all you need is `jq`
|
||||||
|
and you can now parse RSS and implement any custom feature you want.
|
||||||
|
|
||||||
|
If you felt masochistic, you could even read RSS feeds using only your shell, `minrss`, `ls`, `head` and `w3m`.
|
||||||
|
|
||||||
|
This sort of structure is inspired by suckless.org's
|
||||||
|
[ii](http://tools.suckless.org/ii/) and [sic](http://tools.suckless.org/sic/).
|
||||||
|
|
||||||
|
### wrapper script
|
||||||
|
|
||||||
|
I wrote my own wrapper script around MinRSS, called `mrss`.
|
||||||
|
It has the following features:
|
||||||
|
|
||||||
|
- Update feeds using MinRSS
|
||||||
|
- Show all new articles using `fzf` as an interface (as seen in the screenshot above)
|
||||||
|
- Mark articles as read
|
||||||
|
- Mark articles as "watch later"
|
||||||
|
- Custom handler for opening videos and podcasts in `mpv`
|
||||||
|
|
||||||
|
## installation
|
||||||
|
|
||||||
|
First, ensure you have the requirements:
|
||||||
|
|
||||||
|
- libcurl
|
||||||
|
- libxml2
|
||||||
|
- json-c
|
||||||
|
- xdg-open
|
||||||
|
|
||||||
|
Clone the repo:
|
||||||
|
|
||||||
|
git clone https://github.com/dogeystamp/minrss
|
||||||
|
cd minrss
|
||||||
|
|
||||||
|
Edit the config file.
|
||||||
|
The comments in `config.h` should guide you:
|
||||||
|
|
||||||
|
cp config.def.h config.h
|
||||||
|
vim config.h
|
||||||
|
|
||||||
|
MinRSS outputs human-readable output by default.
|
||||||
|
The wrapper script will only work with these options set:
|
||||||
|
|
||||||
|
static const enum outputFormats outputFormat = OUTPUT_JSON;
|
||||||
|
static const enum summaryFormats summaryFormat = SUMMARY_FILES;
|
||||||
|
|
||||||
|
Then, build and install MinRSS:
|
||||||
|
|
||||||
|
make install
|
||||||
|
|
||||||
|
Install the wrapper script:
|
||||||
|
|
||||||
|
cp contrib/mrss.sh ~/.local/bin/mrss
|
||||||
|
chmod 755 ~/.local/bin/mrss
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
For complete help, run `mrss -h`.
|
||||||
|
|
||||||
|
To get started, all you need is `mrss update` to update feeds, then `mrss fzf` to view articles.
|
||||||
|
|
||||||
|
#### fzf shortcuts
|
||||||
|
In `mrss`'s `fzf` interface, the following commands are available:
|
||||||
|
|
||||||
|
| Command | Shortcut | Description |
|
||||||
|
| ------- | -------- | ----------- |
|
||||||
|
| `/read` | `Enter` | Opens link in the browser or `mpv` |
|
||||||
|
| `/purge` | `Ctrl-D` | Mark article as read |
|
||||||
|
| `/purge-all` | `Ctrl-Alt-D` | Mark all articles as read |
|
||||||
|
| `/watch-later` | `Ctrl-W` | Send article to the watch-later folder |
|
||||||
|
| `/queue` | `Ctrl-E` | Queues link to be opened after leaving `fzf` |
|
||||||
|
|
||||||
|
You can also use `Tab` and `Shift-Tab` to select multiple articles to be acted upon.
|
||||||
|
|
||||||
|
#### viewing specific folders
|
||||||
|
|
||||||
|
The `mrss fzf` command can be used to view a specific folder's contents.
|
||||||
|
For example, use
|
||||||
|
|
||||||
|
mrss fzf null-program
|
||||||
|
|
||||||
|
to read all null-program articles (regardless of if they are marked read or not).
|
||||||
|
Or, run
|
||||||
|
|
||||||
|
mrss fzf watch-later
|
||||||
|
|
||||||
|
to see articles you've marked as "watch later".
|
@ -1,3 +1,32 @@
|
|||||||
|
/*
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Bradley Taunt
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
I stole a decent amount of code from the stylesheet of https://barf.bt.ht/
|
||||||
|
so here's the license
|
||||||
|
*/
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: JetBrainsMono, sans-serif;
|
font-family: JetBrainsMono, sans-serif;
|
||||||
width: 85vmin;
|
width: 85vmin;
|
||||||
@ -55,9 +84,6 @@ main p {
|
|||||||
h1,h2,h3,h4 {
|
h1,h2,h3,h4 {
|
||||||
margin: 2rem 0 0;
|
margin: 2rem 0 0;
|
||||||
}
|
}
|
||||||
p {
|
|
||||||
margin-left: 1rem;
|
|
||||||
}
|
|
||||||
h2 {
|
h2 {
|
||||||
margin-left: 0.25rem;
|
margin-left: 0.25rem;
|
||||||
}
|
}
|
||||||
@ -127,7 +153,7 @@ tr {
|
|||||||
border-bottom: 1px solid lightgrey;
|
border-bottom: 1px solid lightgrey;
|
||||||
}
|
}
|
||||||
tr:nth-of-type(odd) td {
|
tr:nth-of-type(odd) td {
|
||||||
background-color: #f8f8f8;
|
background-color: #151515;
|
||||||
}
|
}
|
||||||
th,td {
|
th,td {
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
@ -137,9 +163,10 @@ footer {
|
|||||||
margin: 2rem 0;
|
margin: 2rem 0;
|
||||||
padding: 1rem 15px;
|
padding: 1rem 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
display: inline;
|
display: inline;
|
||||||
color: #aaaaaa;
|
color: #aaaaaa;
|
||||||
}
|
}
|
||||||
|
p, pre, table, blockquote {
|
||||||
|
margin-left: 1rem;
|
||||||
|
}
|
||||||
|
BIN
public/img/minrss-mrss.jpg
Normal file
BIN
public/img/minrss-mrss.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
Loading…
x
Reference in New Issue
Block a user