Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- if [ ! -f "/input/feeds.txt" ]
- then
- >&2 echo "Failed to open file /input/feeds.txt. Exiting."
- exit 1
- fi
- if [ ! -d "/output" ]
- then
- >&2 echo "Failed to switch to directory /output. Exiting."
- exit 1
- fi
- cd /output
- grep "^[^#;]" /input/feeds.txt | while read feed
- do
- echo "[ytdl-pvr] Downloading feed: $feed"
- # Grab the RSS feed from YouTube, grab the recent video URLs, and use yt-dlp to download the video
- # The following arguments are used to download 1080p H.264 videos with AAC audio,
- # such that they can be natively played on devices released within the last 10 years while still having
- # good quality:
- # --format, --remux-video, --merge-output-video
- # The following arguments are used to write thumbnail and metadata to be compatible with Jellyfin.
- # --write-thumbnail, --convert-thumbnails, --embed-thumbnail, --embed-metadata, --embed-subs
- # To help Jellyfin sorting videos by release date, --no-mtime is set to prevent e.g. edits to
- # video comments from making a video seem to be released more recently
- # To prevent the script failing when feeds include a future video, --datebefore now is set
- curl --fail-with-body -L -s "$feed" | xq -r '.feed.entry[0:5] | .[].link."@href"' | yt-dlp \
- --batch-file - \
- --output="%(channel)s/%(upload_date)s %(title)s [%(id)s].%(ext)s" \
- --download-archive .ytdl-pvr-archive.txt \
- --continue \
- --no-progress \
- --format 'bestvideo[vcodec^=avc1]+bestaudio[acodec^=mp4a]' \
- --remux-video "mp4" \
- --merge-output-format "mp4" \
- --no-mtime \
- --no-cache-dir \
- --write-thumbnail \
- --convert-thumbnails jpg \
- --embed-thumbnail \
- --embed-metadata \
- --embed-subs \
- --sub-lang en,en.* \
- --datebefore now
- # Continue processing in case of a processing error
- continue
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement