download-youtube-videos.sh
· 1.1 KiB · Bash
Raw
#!/bin/bash
path="/path/to/youtube-folder"
sudo chown -R user:user "${path}"
yt-dlp --config-location "ytdlp-config.txt" -a "${path}/channels-1.txt"
echo
echo "Deleting JSON files"
echo
for file in "${path}"/*/*.json; do
if [ -f "$file" ]; then
sudo rm "$file"
fi
done
echo "Done"
echo
sudo chown -R jellyfin:jellyfin "${path}"
# ytdlp-config.txt
--progress
--ignore-errors
--check-formats
--format "bestvideo[height<=1080][ext=mkv]+bestaudio[ext=m4a]/best[ext=mkv]/best"
--merge-output mkv
--write-info-json
--write-annotations
--write-thumbnail
--convert-thumbnails jpg
--embed-thumbnail
--embed-chapters
--embed-info-json
--ignore-errors
--add-metadata
--restrict-filenames
--concurrent-fragments 3
--sponsorblock-mark all,-preview,-filler,-interaction
--dateafter now-7days
--playlist-end 10
--no-playlist
--cookies-from-browser firefox:vzh1hdbr.default-release
--compat-options no-youtube-unavailable-videos
--match-filter "!is_live & live_status!=is_upcoming & availability=public & title!*=WAN"
--download-archive "/path/to/youtube/downloaded.txt"
-o "/path/to/youtube/%(channel)s/%(upload_date>%Y-%m-%d)s - %(title)s [%(id)s].%(ext)s"
| 1 | #!/bin/bash |
| 2 | path="/path/to/youtube-folder" |
| 3 | |
| 4 | sudo chown -R user:user "${path}" |
| 5 | |
| 6 | yt-dlp --config-location "ytdlp-config.txt" -a "${path}/channels-1.txt" |
| 7 | |
| 8 | echo |
| 9 | echo "Deleting JSON files" |
| 10 | echo |
| 11 | for file in "${path}"/*/*.json; do |
| 12 | if [ -f "$file" ]; then |
| 13 | sudo rm "$file" |
| 14 | fi |
| 15 | done |
| 16 | |
| 17 | echo "Done" |
| 18 | echo |
| 19 | |
| 20 | sudo chown -R jellyfin:jellyfin "${path}" |
| 21 | |
| 22 | |
| 23 | |
| 24 | # ytdlp-config.txt |
| 25 | --progress |
| 26 | --ignore-errors |
| 27 | --check-formats |
| 28 | --format "bestvideo[height<=1080][ext=mkv]+bestaudio[ext=m4a]/best[ext=mkv]/best" |
| 29 | --merge-output mkv |
| 30 | --write-info-json |
| 31 | --write-annotations |
| 32 | --write-thumbnail |
| 33 | --convert-thumbnails jpg |
| 34 | --embed-thumbnail |
| 35 | --embed-chapters |
| 36 | --embed-info-json |
| 37 | --ignore-errors |
| 38 | --add-metadata |
| 39 | --restrict-filenames |
| 40 | --concurrent-fragments 3 |
| 41 | --sponsorblock-mark all,-preview,-filler,-interaction |
| 42 | --dateafter now-7days |
| 43 | --playlist-end 10 |
| 44 | --no-playlist |
| 45 | --cookies-from-browser firefox:vzh1hdbr.default-release |
| 46 | --compat-options no-youtube-unavailable-videos |
| 47 | --match-filter "!is_live & live_status!=is_upcoming & availability=public & title!*=WAN" |
| 48 | --download-archive "/path/to/youtube/downloaded.txt" |
| 49 | -o "/path/to/youtube/%(channel)s/%(upload_date>%Y-%m-%d)s - %(title)s [%(id)s].%(ext)s" |