I love watching my favorite channels on Youtube. There is such great content out there, and with Patreon, there can be niche channels that I love where the content creators can just what they love, and I can watch! I’m happy to pay them money directly.
But I don’t really like Youtube.com (the platform) exactly. They have other priorities (ads, engagement, enshitification). In the end, I want to watch a video. What if I could just watch a video file, on my computer, that is in my house?
Archiving Channels
yt-dlp is the tool for the job (today) for downloading Youtube (and other platform) videos.
With the right options, you can archive an entire channel for Future Generations to enjoy. Here is an example of how I use it:
channel=pbsspacetime
channelURL="https://www.youtube.com/@$channel/videos"
yt-dlp \
--sleep-requests 1 --sleep-interval 5 --max-sleep-interval 30 --cookies cookies.txt \
--ignore-errors --no-continue --no-overwrites --download-archive archive.log \
--add-metadata --write-description --write-info-json --write-thumbnail --embed-thumbnail --all-subs --embed-subs \
--sponsorblock-remove default --datebefore "$(date --date="30 days ago" +%Y%m%d)" \
"$channelURL" 2>&1 | tee output.log
ytdl-nfo .
Let’s walk through some options:
--sleep-requests 1 --sleep-interval 5 --max-sleep-interval 30 --cookies cookies.txt
: These give the Youtube API a break and allow me to use my own cookies to avoid being detect as a bot.--ignore-errors --no-continue --no-overwrites --download-archive archive.log
: These configureyt-dlp
to go in Archive mode and save the video ids toarchive.log
, ensuring we never download a video twice.--add-metadata --write-description --write-info-json --write-thumbnail --embed-thumbnail --all-subs --embed-subs
: These ensure we are saving everything, including the thumbnail, subs, and all metadata, more on this below.--sponsorblock-remove default --datebefore "$(date --date="30 days ago" +%Y%m%d)"
: SponsorBlock is an amazing database of crowdsourced timestamps of particular sections of video, identifying where the sponsored sections are, more on this below too.
Bulk Downloading
yt-dlp
can be pointed at a whole channel to download.
However, Youtube detecting bots and yt-dlp
avoiding detection is a cat/mouse game.
See the docs on how to download in bulk.
This may not be needed depending on how much you are actually downloading.
Warning: It is a fine line between downloading videos for fair use vs violating Youtube.com’s TOS. Youtube will ban you if you abuse them.
Metadata
The title of this blog post includes “Future Generations”. What does that mean? It means I want the file format and archive to be pleasant to watch far into the future.
That means:
- No ads, sponsors, like/comment/subscribe reminders, or other Youtubisms
- Thumbnails included to capture the author’s original vision for how to represent the video in still format (Without this, the thumbnail for most videos will be identical, because it usually comes from the first 10s of the file)
- Subtitles included
- Future-proof metadata files
yt-dlp
can do all these things!
Additionally, the ytdl-nfo program can save metadata into the one of the most stable metadata formats of all time, the .nfo file.
But regardless of the metadata du jour, yt-dlp
has everything in the .info.json
file for future parsing and extraction.
SponsorBlock
I love SponsorBlock and also Patreon Ajay. It has given hours of my life back and saved me from countless pitches for NordVPN.
With the yt-dlp
SponsorBlock integration, the sponsored segments (and any other filler) are completely striped from the file!
Future generations will not be annoyed with sponsors interjections or interaction reminders.
Conclusion
The archivist in me is happy to have a collection of my favorite videos, on my own computer, in my house, in a format that will outlast Youtube.com.
I can play all my favorites, without Ads, without Sponsor interruptions, no reminders to like and subscribe, with subtitles, in 4k, and offline.
Comment via email