For some time I've been tinkering with a script which manages my own fine-grained youtube subscription preferences, periodically scrapes various pages for metadata, and then as necessary extracts videos by using the youtube-dl utility. The end result is a directory on my machine which always has a few interesting videos to watch, ad-free, tracking-free, network connection free, using my favorite full-featured video playback tools.
You don't need to scrap the page, YouTube provides the RSS stream for each channel: `https://www.youtube.com/feeds/videos.xml?channel_id=[ID]`. The RSS contains the "normal" link of each video, so you can invoke youtube-dl or mpv on it.
Youtube assumes that when creators make a playlist, they’ll add videos to the top. As such, the RSS for a playlist[1] always returns just the top 15 results. But a lot of creators — typically the ones that take greater care into organising their playlists, such as Crash Course[2] — add videos to the bottom of their playlists. Those RSS feeds will be stuck at the same 15 items forever, and your only option is to scrape the page.
You can use youtube-dl's archiving feature for that.
I use it regularly on my fairly large music playlist and it goes through all 20 pages just fine despite adding stuff on the bottom occasionally (I sorted it by creation date)
youtube-dl is really cool, and supports loads of sites as well as just youtube.
VLC can also play youtube URLs directly, although buffering can be annoying.
There's also a Python package called "whitey" which provides an ncurses interface for searching youtube, and sending videos to e.g. mplayer or youtube-dl.
If you want to "subscribe" without needing an account, every youtube channel provides an RSS feed (look in the <head> of the page source).
I legitimately did not know this, thanks for the knowledge share! Can it follow playlist s of videos?
There's a few video game streamers whose commentary and remarks are so funny and well written I find myself listening to them more like a podcast than watching the video, so I'm often queuing up playlists and having the background noise while doing house chores and the like
Well, if you're on Mac and if you want to forgo the playback speed controls (like for, music) I can also recommend Vox earlier versions (2.8.26)[0]
It is an audio player with the youtube-list-as-playlist feature. In my experience, it generally delivers a better sound quality of the same videos than youtube. Copy the url (make sure it's /?list=<id>). Hit Cmd + U, paste, <Enter>. Then optionally download the extension for using keyboard buttons[1] and control playback from there.
Or you can always use `youtube-dl -ix /?list=` then open the resulting files with .opus extension with your favorite player.
Not sure how much you'd benefit from it, given that you've already got a good setup, but I just made a website called HookRSSTube[0] that essentially proxies YouTube RSS feeds and replaces the video playback with HookTube[1] instead.
I'd love to know if you have any comments or suggestions.
Do you have a way to ensure you get the highest quality?
I do similar with cron but often get videos as they're still processing (and thus only at lower qualities). One issue is the channels I 'subscribe' to don't always output at the same resolution and frame rate.. so I can't do a simple 'is video 4k60' test.
I don't think there's any way to know what qualities are currently being prepared. Your best bet might be to just figure out what time that creator typically uploads, and make sure your script doesn't run during that time and for several hours afterward, to give YouTube the time it needs to prepare the high-quality ones.
That's an excellent idea. You can work out a reasonable amount of time to allow YouTube to do the video processing, and then use youtube-dl's "--datebefore" option to only download videos that are at least that old. You'll have to manually compute the date and time for X hours in the past, I suppose.
I actually have a script running on a cron job on my personal server that does approximately this. It downloads into a Syncthing folder that automatically syncs to whatever devices I might want to watch videos on. The difference is I just have a set of playlists for it to download, so I'm relying on the YouTube creators to organize their videos into appropriate playlists, which means it's not exactly "fine-grained". It's basically an 80% solution, and for the remaining 20%, I just invoke youtube-dl manually.
For the few YouTube channels where I actually want to watch every single video uploaded by the creator, I do use this. For the rest, I have to hope that they create playlists for the subset of their videos that I am interested in. Many creators are actually quite diligent about organizing their uploads into playlists.
If you like youtube-dl you should check out mps-youtube (https://github.com/mps-youtube/mps-youtube) which has the ability to use youtuble-dl as the backend I'm pretty sure (i prefer to use the native one personally)
It's also gpl vs youtube-dl's public domain.
I'm sure eventually I'll figure out a way to just do it in emacs. (I'm mostly joking... kinda... maybe.)
I've been a youtube-dl fan for a long time -- it was essential whilst traveling a few years ago with suboptimal 3G bandwidth... these days I usually just paste the URL in to a terminal after typing `mpv` for a minimal experience but still with all the control you might want for playback speed, brightness, screenshots, & skipping around etc. Those who prefer a GUI could use SMplayer.
How well does youtube-dl deal with video playback being restricted to play only from youtube.com? For instance this Tube site can't really play most music videos.
I think others seeking a minimalist youtube experience might enjoy youtube-dl: https://rg3.github.io/youtube-dl/