clean exit when auto subtitle extract fails

This commit is contained in:
simon 2022-02-12 18:52:03 +07:00
parent ce4fa8ee61
commit 78720b33b7
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -62,6 +62,9 @@ class YoutubeSubtitle:
video_media_url = self.video.json_data["media_url"]
media_url = video_media_url.replace(".mp4", f"-{lang}.vtt")
all_formats = all_subtitles.get(lang)
if not all_formats:
return False
subtitle = [i for i in all_formats if i["ext"] == "vtt"][0]
subtitle.update(
{"lang": lang, "source": "auto", "media_url": media_url}