- Notifications
You must be signed in to change notification settings - Fork9
Generate a static HTML page from a collection of feeds wtih a simple CLI tool
License
TheBigRoomXXL/tinyfeed
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
tinyfeed is a CLI tool that generate a static HTML page from a collection of feeds.
It's dead simple, no database, no config file, just a CLI and some HTML
Give it a list of RSS, Atom or JSON feeds urls and it will generate a single HTML page forit. Then you can effortlessly set it up incrond
systemd
oropenrc
and voilà, you’vegot yourself an webpage that aggregate your favorite feeds.
- RSS, Atom and JSON feeds are all supported thanks to the awesomegofeed library
- Highly customizable, especially with the ability to use external stylesheet and templates.
- Dark / Light theme based on system preference
- Generated page is lightweight and fully accessible
- Support a daemon mode to re-generate the output periodically
Live demo:feed.lovergne.dev
Visited links are in yellow, unvisited in blue.
The CLI app is design to work with basic pipelining and stdout redirections.
Tinyfeed expect a list of space or carriage-return separated feeds urls as argument.
Usage: tinyfeed [FEED_URL ...] [flags]Examples: single feed tinyfeed lovergne.dev/rss.xml > index.html multiple feeds cat feeds.txt | tinyfeed > index.html daemon mode tinyfeed --daemon -i feeds.txt -o index.html Flags: -D, --daemon Whether to execute the program in a daemon mode. -d, --description string Add a description after the name of your page -h, --help help for tinyfeed -i, --input string Path to a file with a list of feeds. -I, --interval int Duration in minutes between execution. Ignored if not in daemon mode. (default 1440) -l, --limit int How many articles to display (default 256) -n, --name string Title of the page. (default "Feed") -o, --output string Path to a file to save the output to. -q, --quiet Add this flag to silence warnings. -r, --requests int How many simulaneous requests can be made (default 16) -s, --stylesheet string Path to an external CSS stylesheet -t, --template string Path to a custom HTML+Go template file. -T, --timeout int timeout to get feeds in seconds (default 15)
cat feeds| tinyfeed> /tmp/tinyfeed&& mv /tmp/tinyfeed /path/to/index.html# ORcat feeds| tinyfeed -o /path/to/index.html
You can download the official binaries from thereleases page. Currently arm64 and amd64 architecture on Linux, Mac and Windows and FreeBSD is supported. If you need something else than that, please open an issue and I will add it to the releases process if it's supported by golangcross-compilation.
Here is a quick example of how to install the binary for linux:
wget https://github.com/TheBigRoomXXL/tinyfeed/releases/latest/download/tinyfeed_linux_arm64chmod +x tinyfeed_linux_arm64sudo mv tinyfeed_linux_arm64 /usr/local/bin/tinyfeedtinyfeed --help
go install github.com/TheBigRoomXXL/tinyfeed@latest
docker run thebigroomxxl/tinyfeed --help
This is a simple example of how to runtinyfeed in a docker container. This will mountan entire directory, if you want to bind only the input/output files instead you will haveusebind mounts.
docker run --restart unless-stopped -v /your/path:/app thebigroomxxl/tinyfeed --daemon -i feeds.txt -o index.html
Docker compose equivalent:
services:tinyfeed:image:thebigroomxxl/tinyfeedcommand:--daemon -i feeds.txt -o index.htmlvolumes: -/path/to/your/feeds/:/apprestart:unless-stopped
Here is a simple systemd service file to runtinyfeed when your system start andupdate the page every 12 hours. With this setup you can edit the feeds list at~/feeds.txt
and the output will be updated after the next run.
With the output file at~/index.html
you can access it locally atfile:///home/<USER>/index.html
.If, instead, you want to serve it with a web server you can save it in the web server root directory.
# /etc/systemd/system/tinyfeed.service[Unit]Description=tinyfeed serviceAfter=network.target[Service]Type=simpleRestart=alwaysUser=<USER>WorkingDirectory=/home/<USER>/ExecStart=/usr/local/bin/tinyfeed --daemon -i feeds.txt -o index.html -I 720[Install]WantedBy=mutli-user.target
If you have SELinux enabled you will need to allow systemd to execute binaries in theusr/local/bin
directory with the following commands:
sudo semanage fcontext -a -t bin_t /usr/local/bin sudo chcon -Rv -u system_u -t bin_t /usr/local/bin sudo restorecon -R -v /usr/local/bin
To create an OpenRC service, you just need to add an init file at/etc/init.d/tinyfeed
.Then, you can enable the service withrc-update add tinyfeed default
and start or stop it withrc-service tinyfeed <COMMAND>
. Below, you can find the most minimal service file that will enable you to start and stop tinyfeed with the feed list and rendered page located at/etc/tinyfeed
.
#!/sbin/openrc-rundepend() {need netuse dns }command="/usr/local/bin/tinyfeed"command_args="--daemon -i /etc/tinyfeed/feeds.txt -o /etc/tinyfeed/index.html"command_background=truepidfile="/run/${RC_SVCNAME}.pid"
For more advanced patterns (like running as your user instead of root), you can check out the officialOpenRC documentation on the subject.
You can use GitHub Actions to periodically generate an updated page, similar to a cron job, and host it using GitHub Pages. The advantage of this approach is that it’s free and serverless. Additionally, you can directly update your feed list from GitHub.
To use this method you will need to create a github repository with:
- GitHub Pages enabled
- Arepository variable named FEEDS that contains the list of feeds you want to aggregate
- The following GitHub Actions workflow file located at
.github/workflows/daily.yml
:
name:update-demo-dailyon:schedule: -cron:"0 6 * * *"# every day at 6ampush:tags: -"refresh-github-page"# to manually trigger a refreshjobs:build:runs-on:ubuntu-lateststeps: -name:prepare-pageenv:FEEDS:${{vars.FEEDS}}run:| wget -q -O tinyfeed https://github.com/TheBigRoomXXL/tinyfeed/releases/latest/download/tinyfeed_linux_arm64 chmod +x tinyfeed mkdir www echo $FEEDS | ./tinyfeed > ./www/index.html cp www/index.html www/404.html# 404.html allows every path to be served by the index.html -name:upload-pageuses:actions/upload-pages-artifact@v3with:path:www/deploy:needs:buildpermissions:pages:write# to deploy to Pagesid-token:write# to verify the deployment originates from an appropriate sourceenvironment:name:github-pagesurl:${{ steps.deployment.outputs.page_url }}runs-on:ubuntu-lateststeps: -name:deploy-to-github-pagesid:deploymentuses:actions/deploy-pages@v4
You can provide you own template for page generation. For an exemple templatecheck out thebuilt-in one.To learn about HTML+Go template check theofficial documentation.
Inside you template you will have access to data with the following struct and functions:
typedatastruct {Metadatamap[string]stringItems []*gofeed.ItemFeeds []*gofeed.Feed}funcpublication(item*gofeed.Item)stringfuncdomain(item*gofeed.Item)string
You have created a page with tinyfeed and you want to share it? You can open amerge request or an issue to add it to the demo section.
If you need anything related to this project wether it's' just giving feedback,help to understand something or feature request just open a issue on this repos.
The project was heavily inspired by the awesomely simpletinystatusand message boards like Lobste.rs and Hacker News.
Thank you @MariaLetta for the awesomefree-gophers-packwich I adapted for the banner.
About
Generate a static HTML page from a collection of feeds wtih a simple CLI tool