Skip to content

Instantly share code, notes, and snippets.

@TalalMash
Last active June 28, 2025 17:08
Show Gist options
  • Save TalalMash/b8d27da2eb3c4eee8e95b67d721bbc57 to your computer and use it in GitHub Desktop.
Save TalalMash/b8d27da2eb3c4eee8e95b67d721bbc57 to your computer and use it in GitHub Desktop.
yt-dlp archiver with resolution limit, thumbnail and metadata embeds
#!/bin/sh
#Youtube playlist/video archiver, downloads changes on subsequent run, keeps track in archive.txt file.
#Install yt-dlp from pip: pip install yt-dlp --break-system-packages
#Reopen terminal, run `sh ytdl.sh https://playlistvideourlhere <optional command>`
#Use cookies and remove sleep-interval max-sleep-interval for much faster playlist parsing and speeds.
# --cookies ${COOKIES} \
#https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc
QUALITY="bestvideo[height<=720]+bestaudio"
ARCHIVE_LIST="archive.txt"
LOG=log.txt
#COOKIES=cookies.txt
yt-dlp \
--download-archive ${ARCHIVE_LIST} \
--embed-metadata \
--embed-subs \
--buffer-size 2048K \
--sleep-interval 17 \
--max-sleep-interval 135 \
--no-call-home \
--merge-output-format mkv \
--format ${QUALITY} \
-ciw --restrict-filenames \
--convert-thumbnails jpg \
--embed-thumbnail \
-o "thumbnail:%(title)s.%(ext)s" \
-o "%(title)s.%(ext)s" \
-v $1 $2 > ${LOG}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment