UPDATE: Youtube no longer make the
subscription_manager OPML file available, as such you’ll need to collect the channel_id via the method shown in part 2.2.
This post covers the usage of Newsboat (or Newsbeuter) for terminal based RSS feeds related to news and Youtube. I am using two separate configs as I like to keep a divide between a news feed and a Youtube subscriptions feed.
Part 0 - Prerequisites
First you will need to make sure you have
Newsboat, a media player and a browser installed. I typically use
Firefox for the latter options.
$ sudo apt install newsboat mpv firefox
In order to build out the feed you will first need to get the relevant URLs from the news sites you wish to follow. For example, from ArsTechnica you can use http://feeds.arstechnica.com/arstechnica/index for all news.
If you also want your Youtube subscriptions feed you will need to log into your account and head to https://youtube.com/subscription_manager. Once there if you scroll down to the bottom of the page you should see an “Export to RSS readers” option. Click “Export Subscriptions”, this will download an OPML file called
subscription_manager which can be imported to Newsboat.
Part 1 - Create Aliases
As I like to keep news and Youtube subscription feeds separate, I create two aliases to make these easier to define.
1. News Feed Alias
To make a new alias add the following to your
~/.bashrc file (or alternative shell configuration file).
alias nwboat="newsboat -u ~/.newsboat/urls -c ~/.newsboat/cache.db -C ~/.newsboat/config"
2. Youtube Subscription Feed Alias
Now make another new alias in the
~/.bashrc file again for your Youtube feed.
alias ytboat="newsboat -u ~/.newsboat/yturls -c ~/.newsboat/ytcache.db -C ~/.newsboat/ytconfig"
Part 2 - Configure Newsboat
Now that we have created our aliases, we should run the following.
$ source ~/.bashrc
If we run
newsboat from the terminal you will notice it will error because no URLs have been configured. Let’s remedy this by adding our feeds and completing the configuration options we need.
1. Configuration Files
Firstly, let’s add which browser you wish to open links in for the news feed configuration file. Although I don’t typically open links for my news feed, it’s useful to have incase you do want to.
$ echo "browser firefox" >> ~/.newsboat/config
We will also add a line so that the feed auto-reloads when the program is started.
$ echo "auto-reload yes" >> ~/.newsboat/config
Now do the same for the Youtube feed configuration file. Unlike the news feed, this one is essential as it provides the ability to watch videos without visiting the website (the entire reason for doing this..).
$ echo "browser mpv" >> ~/.newsboat/ytconfig
Again, we will add the auto-reload option.
$ echo "auto-reload yes" >> ~/.newsboat/ytconfig
2. URL Files
Now we can finally add URLs that we wish to view in the feeds.
2.1. News Feed URL
To do this for the news feed, simply open up the relevant file in a text editor and add the URLs you want, like so (notice the last link has an added tag at the end, this is useful for your own categorisation):
$ vim ~/.newsboat/urls http://www.theregister.co.uk/headlines.atom http://www.phoronix.com/phoronix-rss.php http://feeds.arstechnica.com/arstechnica/index https://www.reddit.com/r/sysadmin/.rss "~/r/sysadmin"
To add more feeds to the news feed it’s just a case of opening the
urls file and appending it with the new feeds you wish to view.
2.2. Youtube Feed URL
First we need to import the
subscription_manager file we downloaded from Youtube earlier while logged in.
$ ytboat -i /path/to/subscription_manager
To add further subscriptions you have two options. Firstly, you can go to the website, subscribe as normal and then redownload the file and import it as we have just done.
The second option is to follow the same syntax that is in the current
yturls file to add more subscriptions. The last part of the URL is a unique
channel_id and as such you need to be sure you’re adding the correct one.
To find the
channel_id value, go to the channel’s front page on Youtube in your browser, right click and press
View Page Source, from there find the following entry:
link rel="canonical" href=
You should notice a URL after that, the last part of that URL contains the unique
channel_id value we require. The value always begins with
UC so copy the following for example:
So for example, appending the following to the
yturls file would result in adding PewDiePie to the feed…
$ echo "https://www.youtube.com/feeds/videos.xml?channel_id=UC-lHJZR3Gqxm24_Vd_AJ5Yw" >> ~/.newsboat/yturls
Part 3 - Running Newsboat
Now that we have aliases, configuration files and URL files added, you can simply run Newsboat with the aliases you assigned to view your feeds.
To update and grab the latest stories/videos simply press
shift + R. You may notice that when you open your Youtube feed for the first time that it doesn’t contain channel names, these will be added once you run the
Reload All command.
Although there is a key at the bottom of Newsboat to tell you how to use it, I will briefly mention them.
q = quit or go back ENTER = open n = next unread r = reload currently selected Shift + r = reload entire feed Shift + a = mark read Shift + c = mark all read / = search
For my own workflow I typically run
ytboat and then scroll down to channels marked with the “N” tag, press ENTER to go into them and if the video sounds worthwhile I will press
o to automatically open that video in MPV.
Note that channel names will show in your feed after the first time you run a reload all with
Shift + r.
Part 4 - Enjoy!
I’ve found that using Newsboat makes following news less time consuming and I am able to procrastinate less on Youtube by avoiding their linked or recommended videos entirely. I simply watch the few videos that I am interested in and avoid ones that don’t suit.