Download your YouTube "Watch later" playlist w/ only Docker as a prerequisite.
The yt-dlp-batch-builder
container runs a Python parser of the HTML of your "Watch later" playlist. This is used over the API, which requires authentication in a browser, just creating an extra step. yt_dlp_batch.txt
results, which is input for the yt-dlp
container whose arguments are documented here. Here, 720p videos favoring open codecs & containers (AV1, VP9, Opus, WebM) truncated by SponsorBlock are downloaded. Intermediate files & containers are also cleaned up.
git clone https://github.com/atloo1/yt-dlp-batch-builder.git
cd yt-dlp-batch-builder/
Download your YouTube "Watch later" playlist. Defaults are assumed: C:\Users\$env:USERNAME\Downloads\"Watch later - YouTube.htm"
for Windows & ~/Downloads/"Watch later - YouTube.html"
for Unix.
docker build . -t yt-dlp-batch-builder
Rename-Item -Path C:\Users\$env:USERNAME\Downloads\"Watch later - YouTube.htm" -NewName watch_later.html
docker run `
-v C:\Users\$env:USERNAME\Downloads\watch_later.html:/app/watch_later.html `
--name yt-dlp-batch-builder `
yt-dlp-batch-builder `
--input-filepath watch_later.html `
--output-filepath yt_dlp_batch.txt
docker cp yt-dlp-batch-builder:/app/yt_dlp_batch.txt C:\Users\$env:USERNAME\Downloads
# optionally edit yt_dlp_batch.txt
docker run `
-v C:\Users\$env:USERNAME\Downloads\yt_dlp_batch.txt:/downloads/yt_dlp_batch.txt `
--name yt-dlp `
jauderho/yt-dlp:latest `
-a yt_dlp_batch.txt `
-f "bv[height=720]+ba[acodec=opus][ext=webm]" `
-o "%(title)s_%(channel)s.%(ext)s" `
--embed-chapters `
--embed-subs `
--exec 'mv {} $(echo {} | tr "[:upper:]" "[:lower:]")' `
--restrict-filenames `
--sponsorblock-remove all
docker cp yt-dlp:/downloads/. C:\Users\$env:USERNAME\Videos\youtube
rm C:\Users\$env:USERNAME\Downloads\"Watch later - YouTube_files\" -Recurse
rm C:\Users\$env:USERNAME\Downloads\watch_later.html
rm C:\Users\$env:USERNAME\Downloads\yt_dlp_batch.txt
rm C:\Users\$env:USERNAME\Videos\youtube\yt_dlp_batch.txt
docker run `
--name yt-dlp `
--entrypoint /bin/sh `
jauderho/yt-dlp:latest `
-c "sleep infinity"
docker exec -it yt-dlp /bin/sh
mv ~/Downloads/"Watch later - YouTube.html" ~/Downloads/watch_later.html
docker run \
-v ~/Downloads/watch_later.html:/app/watch_later.html \
--name yt-dlp-batch-builder \
yt-dlp-batch-builder \
--input-filepath watch_later.html \
--output-filepath yt_dlp_batch.txt
docker cp yt-dlp-batch-builder:/app/yt_dlp_batch.txt ~/Downloads/
# optionally edit yt_dlp_batch.txt
docker run \
-v ~/Downloads/yt_dlp_batch.txt:/downloads/yt_dlp_batch.txt \
--name yt-dlp \
jauderho/yt-dlp:latest \
-a yt_dlp_batch.txt \
-f "bv[height=720]+ba[acodec=opus][ext=webm]" \
-o "%(title)s_%(channel)s.%(ext)s" \
--embed-chapters \
--embed-subs \
--exec 'mv {} $(echo {} | tr "[:upper:]" "[:lower:]")' \
--restrict-filenames \
--sponsorblock-remove all
docker cp yt-dlp:/downloads/. ~/Videos/youtube
rm ~/Downloads/watch_later.html
rm ~/Downloads/yt_dlp_batch.txt
rm ~/Videos/youtube/yt_dlp_batch.txt
docker run \
--name yt-dlp \
--entrypoint /bin/sh \
jauderho/yt-dlp:latest \
-c "sleep infinity"
docker exec -it yt-dlp /bin/sh
docker rm yt-dlp-batch-builder yt-dlp
poetry install --without dev
poetry run python -m yt_dlp_batch_builder.main --help
pyenv install 3.9 --skip-existing # or your choice
pyenv local 3.9 # or your choice
poetry install
poetry run pre-commit install