../home

newsboat+mpv: browserless youtube zen

over the past few years i’ve started consuming most of my content through youtube and have a specific set of channels i regularly watch. a few months ago i happened to come across mpv1 and newsboat2 and found that combining them made for a pretty great way to to watch videos without having to always keep a dedicated browser window open for it.

the basic idea is to use newsboat (an rss tracker) to track the feeds for specific youtube channels and playlists, and configure it to use mpv to open the youtube links. mpv supports streaming youtube videos out of the box via yt-dlp (the successor to youtube-dl) so this kind of Just Works without much effort.

dependencies

first things first, install the main two things we’ll need.

sudo apt install mpv newsboat

when i originally set this up i had some issues using the default yt-dlp package that’s installed by debian and ubuntu when mpv is installed so i removed that version and installed the package manually using pipx.

sudo apt purge yt-dlp
pipx install yt-dlp

configuration

mpv supports creating sets of custom config settings under profiles that can be applied on-demand via commandline args so i created a profile to have consistent settings applied for youtube links. obvously you can tweak the ytdl format settings to increase/decrease the quality based on your own needs but these are the settings i’ve found worked best for me.

[ytv]
cache-pause-initial=yes
ytdl-format="bestvideo[height<=720]+bestaudio/best"

next up is the newsboat config. this sets just a couple of settings, most important of which is setting the default browser command to mpv so opening the tracked video links in newboat correctly opens them up for viewing.

include /usr/share/doc/newsboat/contrib/colorschemes/solarized-dark

auto-reload yes
reload-time 120
reload-threads 10

# set browser to mpv so links are opened through it
browser "mpv --profile=ytv %u"

usage

its possible to track both channels and individual playlists with newsboat using the feed URLs youtube supports. i’ve found that tracking playlists is a bit easier since there doesn’t seem to be an easy way to grab channel ids without digging through a bunch of pages in the youtube ui. thankfully most of the channels i follow have a playlist that has all videos so that usually works.

https://www.youtube.com/feeds/videos.xml?channel_id=<channel-id>
https://www.youtube.com/feeds/videos.xml?playlist_id=<playlist-id>

finally, i created this simple script to start newsboat with the custom config file, cache file, and urls file. the cache file is imporant to allow multiple instances of newboat to run in case you also want to use newboat to tracking normal feeds.

#!/bin/bash

newsboat -u "$HOME/.config/newsboat/tubeboat.urls" \
    -C "$HOME/.config/newsboat/tubeboat.config" \
    --cache-file="$HOME/.newsboat/tubeboat-cache.db"

screenshot

screenshot