Skip to content

Instantly share code, notes, and snippets.

@Synertry
Last active February 27, 2022 12:05
Show Gist options
  • Save Synertry/b2445850c09f59fd0838ab13e31e0f1b to your computer and use it in GitHub Desktop.
Save Synertry/b2445850c09f59fd0838ab13e31e0f1b to your computer and use it in GitHub Desktop.
YouTube channel archiving bootstrap

YT-ChannelArchiver Origin

This is the configuration I've came up after reading the documentation and options of https://github.com/yt-dlp/yt-dlp

DISCLAIMER: This is not a step-to-step-guide, see it more like a bootstrap, to use the best options

Required:

Install via Python and add bin dir to path

python3 -m pip install --force-reinstall https://github.com/yt-dlp/yt-dlp/archive/master.zip

Use the patched ffmpeg Otherwise you will have problems merging VP9 and Opus

For a more sophisticated setup check my repo https://github.com/Synertry/YT-ChannelArchiver

I've used the deletion of Rushia Ch. 潤羽るしあ as motivation, that's why here channel is the example link

#!/usr/bin/env bash
# SOURCE: https://gist.github.com/Synertry/
yt-dlp \
--cookies youtube.com_cookies.txt \
--no-progress \
--ignore-errors --retries 20 \
--concurrent-fragments 4 \
--write-url-link --write-webloc-link --write-desktop-link \
--format 'bv*+ba/b' \
--ffmpeg-location "$HOME/ffmpeg-master-latest-linux64-gpl/bin" \
--merge-output-format mkv \
--audio-quality 0 \
--write-info-json --write-all-thumbnail --write-description --write-comments --write-playlist-metafiles \
--sub-langs all --write-subs --sub-format 'ass/srt/best' \
--embed-thumbnail --embed-metadata \
--no-playlist --no-write-playlist-metafiles --playlist-reverse \
--download-archive YouTube-Video_IDs.txt \
--paths "$HOME/ytp-dlp/download" --paths "temp:$HOME/yt-dlp/tmp" \
--output '%(channel)s/%(upload_date)s_%(title)s/%(title)s [%(id)s][%(vcodec)s %(resolution)s %(acodec)s].%(ext)s' \
--output 'subtitle:%(channel)s/%(upload_date)s_%(title)s/subs/%(title)s [%(id)s].%(ext)s' \
--output 'thumbnail:%(channel)s/%(upload_date)s_%(title)s/thumbs/%(title)s [%(id)s](thumb).%(ext)s' \
--output 'description:%(channel)s/%(upload_date)s_%(title)s/%(title)s [%(id)s].%(ext)s' \
--output 'infojson:%(channel)s/%(upload_date)s_%(title)s/%(title)s [%(id)s].%(ext)s' \
--output 'link:%(channel)s/%(upload_date)s_%(title)s/links/%(title)s [%(id)s](link).%(ext)s' \
--output 'chapter:%(channel)s/%(upload_date)s_%(title)s/chapter/%(title)s [%(id)s](chapter).%(ext)s' \
--output 'pl_thumbnail:%(channel)s/%(upload_date)s_%(title)s/pl/%(title)s [%(id)s](thumb).%(ext)s' \
--output 'pl_description:%(channel)s/%(upload_date)s_%(title)s/pl/%(title)s [%(id)s].%(ext)s' \
--output 'pl_infojson:%(channel)s/%(upload_date)s_%(title)s/pl/%(title)s [%(id)s].%(ext)s' \
--output 'pl_video:%(channel)s/%(upload_date)s_%(title)s/pl/%(title)s [%(id)s][%(vcodec)s %(resolution)s %(acodec)s].%(ext)s' \
https://www.youtube.com/channel/UCl_gCybOJRIgOXw6Qb4qJzQ/videos \
2>&1 | tee "yt-dlp_videos_$(date +'%Y%m%d').log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment