Make sure we check for subtitles before non-YouTube videos
- ID
78ce6f6- date
2024-03-13 16:42:56+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
caa05f9- message
Make sure we check for subtitles before non-YouTube videos- changed files
1 file, 9 additions, 5 deletions
Changed files
web/yt-dlp.py (2452) → web/yt-dlp.py (2541)
diff --git a/web/yt-dlp.py b/web/yt-dlp.py
index 2121320..f9f321d 100755
--- a/web/yt-dlp.py
+++ b/web/yt-dlp.py
@@ -37,12 +37,10 @@ if __name__ == "__main__":
# assume we're downloading some other source and call yt-dlp as usual.
youtube_url_matches = [a for a in argv if "youtube.com" in a]
- if len(youtube_url_matches) != 1:
- subprocess.check_call([yt_dlp_path] + argv)
- sys.exit(0)
-
remaining_args = [a for a in argv if "youtube.com" not in a]
- youtube_url = youtube_url_matches[0]
+
+ if "--write-sub" in remaining_args:
+ sys.exit("Did you mean --write-subs?")
# I always want subtitles in srt format, so make sure I've done that.
#
@@ -54,6 +52,12 @@ if __name__ == "__main__":
) and "--convert-subtitles=srt" not in remaining_args:
sys.exit("Did you forget to add --convert-subtitles=srt?")
+ if len(youtube_url_matches) != 1:
+ subprocess.check_call([yt_dlp_path] + argv)
+ sys.exit(0)
+
+ youtube_url = youtube_url_matches[0]
+
# 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):