| 1 | #!/bin/bash |
| 2 | # */3 * * * /bin/bash -c "download-youtube-videos.sh" |
| 3 | path="/path/to/youtube" |
| 4 | |
| 5 | sudo chown -R airikr:airikr "${path}" |
| 6 | |
| 7 | yt-dlp \ |
| 8 | --progress \ |
| 9 | --ignore-errors \ |
| 10 | --check-formats \ |
| 11 | --format "bv*[height<1080][ext=mp4]+ba" \ |
| 12 | --cookies-from-browser firefox:av9irb5a.edgren \ |
| 13 | --merge-output mkv \ |
| 14 | --write-info-json \ |
| 15 | --write-annotations \ |
| 16 | --write-thumbnail \ |
| 17 | --convert-thumbnails jpg \ |
| 18 | --embed-thumbnail \ |
| 19 | --embed-chapters \ |
| 20 | --embed-info-json \ |
| 21 | --ignore-errors \ |
| 22 | --add-metadata \ |
| 23 | --parse-metadata "%(title)s:%(meta_title)s" \ |
| 24 | --parse-metadata "%(uploader)s:%(meta_artist)s" \ |
| 25 | --restrict-filenames \ |
| 26 | --concurrent-fragments 3 \ |
| 27 | --sponsorblock-mark all,-preview,-filler,-interaction \ |
| 28 | --dateafter now-7days \ |
| 29 | --playlist-end 10 \ |
| 30 | --no-playlist \ |
| 31 | --compat-options no-youtube-unavailable-videos \ |
| 32 | --match-filter "!is_live & live_status!=is_upcoming & availability=public" \ |
| 33 | --download-archive "${path}/downloaded.txt" \ |
| 34 | -a "${path}/channels.txt" \ |
| 35 | -o "${path}/%(channel)s/%(upload_date>%Y-%m-%d)s - %(title)s [%(id)s].%(ext)s" 2>&1 | tee "${path}/output.log" |
| 36 | |
| 37 | sudo chown -R jellyfin:jellyfin "${path}" |
airikr / Download videos from YouTube (not AI, my own)
Last active 4 months ago
This script downloads videos from 7 days to today from selected YouTube channels. Downloaded videos will be logged in download.txt to prevent re-downloading them.
Revision 2fafc2c88be82276b6fea743b55c60528f44154d