Skip to content

Instantly share code, notes, and snippets.

@johnroyer
Created November 24, 2023 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnroyer/db9b42a1d453359cd4125f07e5b13bc9 to your computer and use it in GitHub Desktop.
Save johnroyer/db9b42a1d453359cd4125f07e5b13bc9 to your computer and use it in GitHub Desktop.
script for download youtube video via yt-dlp
#!/usr/bin/env bash
# Usage:
# dl.sh "https://www.youtube.com/watch?v=ec-IgIkEkmA"
#
# 限制檔案名稱長度,主要是為了避開 FAT、NTFS 的限制
/path/to/yt-dlp/yt-dlp.sh \
-o '%(title).150s-%(id)s.%(ext)s' \
-f "bestvideo[height<=1080][ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \
--write-subs --sub-langs "zh-TW" --sub-format "srt/vtt" \
-q \
"$@" > /dev/null 2>&1 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment