emacs and elfeed and youtube oh my

i'm fully aware that this is a weirdly precise setup for a weirdly niche group of folks, but it took me some time to figure out! so i'm sharing it, in case i have to do it again.

i watch youtube to chill. various different youtubers. from weird minecraft folks, to techie guys all the way round to vlogs. i've been collecting subscriptions for years, and was happily paying for youtube premium since i watch so much of it, and i hate ads as much as the next guy.

recently, youtube has decided to up the fee for premium from a fairly reasonable 15 bucks, to a much less reasonable 24 bucks. that's almost 10 bucks jump! i don't know if that's reflecting over to paying youtubers, but considering how many of them beg for patreon users, members, twitch follows, merch stuff, etc. i'm going to assume no one is getting paid but some big wig at google headquarters.

so i swapped over to an alternative lack of ads, i tried various alternative frontends, and they don't do it for me. my youtube flow is subs, hit watch later, watch the watch later playlist. none of the other frontends seem to support that, and i was too lazy to figure out other means.

which lead me back to emacs. elfeed processes rss feeds in emacs, and invidious has rss feed links on every sub. i just need to put my subs into elfeed, and then figure out how to add those to a playlist.

emms plays videos as easily as it does music, and it supports playlists.

and mpv with youtube-dl supports playing youtube feeds, or indeed invidious feeds.

so here we are!

1. import you subs from invidious. if you imported your youtube feeds this is stupid easy, since they support exporting. and honestly just using the youtube feeds would be fine. i'd already set things up with invidious, so i just didn't swap back. elfeed-load-opml and boom. they're in.

2. add a switch to your init.el that pushes invidious/youtube links to the playlist instead of to your browser.

(defun emms-yt (url &optional new-window)

(emms-add-url url))

(setq browse-url-handlers '(("https:\\/\\/inv." . emms-yt)

("." . browse-url-xdg-open)))

3. hit b to open the feeds, it'll auto populate a playlist in emms which you can now watch by running emms-start in emacs. boom. your youtube feed is playing.

now, a few caveats. mpv closes after each video and then reopens which means if like me you're on two monitors with youtube on the one you're not watching, you will constantly be interrupted by mpv opening on your main monitor. the secret is

(setq-default emms-player-mpv-parameters '("--save-position-on-quit" "--player-operation-mode=pseudo-gui"))

which makes the window not close, and instead just keep open til the next video plays.

that save position on quit section just means if i close mpv, it will start where i left off on restarting it.

now emms playlists don't stay on resetting emacs, so make sure if you ever (heavens forbid) leave emacs, you save the playlist with emms-playlist-save. you can reopen it on next run with emms-play-playlist.

and that's that. ads gone, youtube playing nicely in mpv, and all of it in emacs as the good gnu intended.

feeds

rss
gemini
gopher

email

zote