Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.

hpr3695 :: How I watch youtube with newsboat

Using youtube's channel RSS feeds to watch youtube from the command line

<< First, < Previous, , Latest >>

Hosted by binrc on 2022-09-30 is flagged as Explicit and is released under a CC-BY-SA license.
newsboat, RSS, youtube. 4.

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:11:03


How I watch youtube with newsboat

I find that the youtube web ui is designed to keep users on the site by feeding them an unending stream of information. Bright colors, distracting thumbnails, peanut galleries, etc. I prefer to consume my videos in the same way I consume everything else: via RSS.

RSS is my favorite way of aggregating things that other people have made because it allows me, the user, to interact with their things

The only dependencies not on a standard UNIX system are newsboat and a video player. I also use yt-dlp to download videos for later viewing. I like mpv but you can substitute your own.

$ sudo $pkgmrg install newsboat mpv yt-dlp

Getting RSS feeds from youtube

Youtube (currently) provides RSS feeds for channels.

Finding Youtube channel ID

Sometimes channels have vanity URLs that can make it difficult to find the channel ID. Other times, the URL contains the channel ID. All youtube channel IDs start with the string UC so we can easily grep for them.

$ curl | grep --color "href=\"\""
[ lots of nonsense ]
[ lots of nonsense ]

In order to turn this channel ID into something useful, we create the following URL:

Google takeout can also be used to export youtube subscriptions.

The export format is a CSV that contains the channel IDs for all of our subscriptions.

Channel Id,Channel Url,Channel Title
UCLEoyoOKZK0idGqSc6Pi23w,,RMC - The Cave

Newsboat url list

Newsboat reads it’s list of URLs from ~/.config/newsboat/urls. Every url we add to this list will be automaticlly fetched. You can make separate URL lists for your list of videos and list of standard text based RSS feeds

If you have an exported CSV, you can easily modify it so that newsboat will accept it as a list of URLs by deleting row 1, column 1+comma, and replacing the comma between the URL and channel name with a tab character. Doing a sed 's/channel\//feeds\/videos.xml?channel_id=/g' on the file is an easy way to replace the website URL with the feed url. Newsboat only reads the first field of every row so the channel name can be kept for easier subscription management.     RMC - The Cave

Newsboat config

In order to play videos, we need to add some macros to the newsboat config file at ~/.config/newsboat/config

Mine looks like this.

# load URLS on launch
auto-reload  yes

# vim binds
bind-key j down
bind-key k up
bind-key j next articlelist
bind-key k prev articlelist
bind-key J next-feed articlelist
bind-key K prev-feed articlelist
bind-key G end
bind-key g home
bind-key d pagedown
bind-key u pageup
bind-key l open
bind-key h quit
bind-key a toggle-article-read
bind-key n next-unread
bind-key N prev-unread
bind-key D pb-download
bind-key U bashow-urls
bind-key x pb-delete

# macro setup
browser linkhandler
macro , open-in-browser

# launch video player
macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler

# download video
macro d set browser "yt-dlp"; open-in-browser ; set browser linkhandler

# download audio only
macro a set browser "yt-dlp --embed-metadata -xic -f bestaudio/best" ; open-in-browser ; set browser linkhandler

Video demo

This is a demo of using newsboat with videos. In order to execute the macros, you type , then v or whatever other letter you set the macro to.

video in webm format your web browser or operating system does not support free video codecs :(

A url list to get you started        Andreas Kling        Computerphile        Elliot Coll        Learn Linux TV        LockPickingLawyer        Louis Rossmann        Luke Smith        Mental Outlaw        Modern Vintage Gamer        RMC - The Cave        Scott The Woz        Techmoan        Technology Connections        The 8-Bit Guy        The Linux Experiment        This Week in Retro        Wolfgang's Channel        decino                


Subscribe to the comments RSS feed.

Comment #1 posted on 2022-09-30 10:33:35 by folky

Great for gpodder too

Hi! Thank you for your great show. I could use the url I got your way for gPodder too, but not for castget. Just for those who wanted to use something other than newsboat.
Comment #2 posted on 2022-10-01 01:44:44 by binrc


I forgot to say in the show, "Video feeds also seem to work with the Antenna Pod app from F-Droid on android". Automatic audio-only playback of videos seems to work also. Hack the planet? No, I want to RSS-ify the planet.
Comment #3 posted on 2022-10-03 16:56:38 by Dave Morriss

Great show, but I have questions

Hi, This was most interesting. I tried out newsboat after installing it with mpv and yt-dlp. I tried your configuration file as a starting point but I got an error. I found newsboat didn't like: bind-key U bashow-urls I used 'show-urls' which I found in the documentation. Also, what's linkhandler? If you mentioned it in the audio I missed it. Thanks for the show. I suspect I will be using newsboat from now on.
Comment #4 posted on 2022-10-20 22:31:50 by Nate

use an invidious instance to get the channel id

thanks for the newsboat reference.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Anti Spam Question: What does the P in HPR stand for ?