From 78720b33b72bf6d39d444bae14324b7fb9fe4f52 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 12 Feb 2022 18:52:03 +0700 Subject: [PATCH] clean exit when auto subtitle extract fails --- tubearchivist/home/src/index/video.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tubearchivist/home/src/index/video.py b/tubearchivist/home/src/index/video.py index 7fbbf6f..bc6f272 100644 --- a/tubearchivist/home/src/index/video.py +++ b/tubearchivist/home/src/index/video.py @@ -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}