Make sure I always get subtitles in srt format
- ID
067f415- date
2024-03-13 08:54:14+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
b9c5a67- message
Make sure I always get subtitles in srt format- changed files
1 file, 8 additions
Changed files
web/yt-dlp.py (1958) → web/yt-dlp.py (2439)
diff --git a/web/yt-dlp.py b/web/yt-dlp.py
index 8f12061..9653e20 100755
--- a/web/yt-dlp.py
+++ b/web/yt-dlp.py
@@ -44,6 +44,14 @@ if __name__ == "__main__":
remaining_args = [a for a in argv if "youtube.com" not in a]
youtube_url = youtube_url_matches[0]
+ # I always want subtitles in srt format, so make sure I've done that.
+ #
+ # Note: I could add this automatically, but it means vanilla yt-dlp
+ # and my wrapper would behave differently. That could get confusing!
+ # So just add a prompt rather than fixing it.
+ if ("--write-subs" in remaining_args or "--write-auto-subs" in remaining_args) and "--convert-subtitles=srt" not in remaining_args:
+ sys.exit(f"Did you forget to add --convert-subtitles=srt?")
+
# If this is a YouTube URL but it's not a playlist, then it's probably
# a single video. Download it as normal.
if not is_playlist(youtube_url):