Aaron Ulises Jauregui Zepeda

...or Aaron Jauregui depending on how much space there is on your form

Rolling my own RSS-based frontend for mpv with sfeed and yt-dlp

Content recommendation algorithms are probably the most dangerous and destructive part of the corporate Internet. Despite this people (knowingly) expose themselves to this knowingly and on a daily basis. While an argument could be made for this infinite stream of user-generated content’s benefits in educational (at best) and entertainment (at worst) value, the drastic shortening of attention spans and the inability to maintain an inner voice this constant barrage of external stimulus causes is proving to be catastrophic. So what is one to do? You could unplug your computer and throw it into the nearest reasonably-sized body of water. I understand the sentiment, but until then there is a relatively straightforward way of removing the most detrimental aspects of the YouTube experience while not having to give up on content that genuinely interests you.

The main idea behind this project is to abstract out the front-end for watching video content, instead using RSS feeds. Not only does this cut out the worst offenders of algorithmic content recommendation, but it also makes your watchlist platform-agnostic (as it should be). When the YouTube content police decides your favourite channel is no longer welcome and it gets forced into something like peertube, for you it should be nothing more inconvenient than replacing the feed URL.

I use sfeed as my RSS feed reader and can’t recommend it enough. It is minimal, scriptable, and portable. Due to it’s simplicity, you can get a very good understanding of it very quickly and incorporate it into whatever method of viewing feeds suits you best with just shell scripts. The sfeed-curses UI is bundled with the base sfeed install, and is the interface of choice for this script. sfeed allows you to set the “plumber” application through an environment variable. Changing the plumber allows you to choose what program is to consume a given RSS entry’s URL and do work with it. I wrote the following simple script to act as a plumber:

#!/bin/sh
notify-send "Opening a video" "$1"
mpv --force-window \
	--ytdl-format="bestvideo[height<=?1080]+bestaudio/best" $1

MPV’s excellent support of yt-dlp streams makes setting the plumber basically a one-liner. Using a dedicated script makes further interoperability really easy, and I experimented with downloading the video file to an archive as I watched it. I found that I never went back to re-watch old videos, so I just took the line out. I just send out a notification to let myself know that the video is loading, since it can sometimes take a few seconds for MPV to start. Video streams will load in the best available quality up to 1080p, since my home connection gets very upset at me if I try to stream anything of higher quality.

Using this as a plumber is sufficient to detach yourself from YouTube and enjoy the content you want with no recommendation algorithm whatsoever, and we can get pretty easy quality-of-life wins now that everything is being done in the shell. You can extend the functionality of your setup organically, adding features as you need them. For example, I have a wide array of interests that come and go, so a tagging system is very useful for me. Here’s a simple shell regex-based tagged sfeed feed fetcher:

#!/bin/sh

player= #the plumber script above
feeds_dir="/path/to/sfeed/feeds"

[ "$1" = "clean" ] && rm -f $feeds_dir/*yt && exit

# fetch feeds based on tag, will only fetch favorites '[F]' by default

[ -z "$1" ] && SFEED_PLUMBER=$player sfeed_curses \
		$feeds_dir/\[F\]*yt && exit
[ "$1" = "all" ] && SFEED_PLUMBER=$player sfeed_curses \
		$feeds_dir/*yt && exit
[ "$1" = "list" ] && ls $feeds_dir/*yt -1 \
		| awk -v FS="-" '{print $(NF-1)}'\
		| sort\
		| uniq && exit

SFEED_PLUMBER=$player sfeed_curses $feeds_dir/*$1-yt

This script allows me to keep a single sfeedrc with all my feeds in it, while allowing me to only fetch video feeds (indicated by a yt suffix). Feeds are tagged arbitrarily with a field separated from the yt suffix with -. I can also tag feeds as favourites with an [F] prefix, bypassing tags but reducing clutter. The list tag lists out all existing tags. The all tag is reserved and self-explanatory. My feed definitions look something like this:

	feed "[F]Feed 1-foo-yt" 	"<feed_url>"
	feed "Feed 2-foo-yt"		"<feed_url>"
	feed "[F]Feed 3-bar-yt"		"<feed_url>"
	feed "Feed 4-baz-yt"		"<feed_url>"

I can fetch feeds 1 and 3 by simply calling yt (the name of the script) since they’re tagged as favourites. Videos 1 and 2 get fetched by calling yt foo, and so on. You get the idea. I find this system pretty convenient and easy to use, since there’s never any need to modify or store any code to create tags beyond typing out the feed entry, and the tagging system feels pretty intuitive.

Note that this is certainly not a novel idea, and there is likely better ways of doing it than the one I opted for, but it is robust and functional for my use-case (I have been using this method for around a year with no problems!).

Choosing feeds

While YouTube has native RSS support, it is well-hidden for a reason. They do not want you to use it. Instead of relying on a hostile platform’s not removing the functionality, I recommend running an Invidious or Piped instance as an alternative front-end to YouTube that natively supports RSS, and mostly works while having JavaScript disabled(!). You can also use a public instance of either of the two services.

Sure, if you find the visual style distracting you can switch into reading mode with the "toggle" text beside my face.

I'd love to read what you've got to say. Shoot me a message to contact (at) aaronjau (dot) com, or bring it up with me IRL and you'll make my day.

You might be interested in my most recent blog post:
Minimalist static sites with shpp