Spaces:
Runtime error
Runtime error
Add chapters.
Browse files- fetchYoutubeSubtitle.py +1 -1
fetchYoutubeSubtitle.py
CHANGED
@@ -70,7 +70,7 @@ async def fetchSubtitlebyType(url: str, lang: Optional[str] = 'en', subType="vtt
|
|
70 |
with ydl.urlopen(subtitle_url) as response:
|
71 |
subtitle = xml_caption_to_srt(response.read().decode()) if isSrt else response.read().decode()
|
72 |
print("url{}, title:{}, duration:{} len(subtitle): {}".format(url, title, duration, len(subtitle)))
|
73 |
-
return {"title": title, "duration": duration,"subtitle": subtitle}
|
74 |
except Exception as e:
|
75 |
return {"error": str(e)}
|
76 |
return {"title": title, "duration": duration, "error": "No subtitles"}
|
|
|
70 |
with ydl.urlopen(subtitle_url) as response:
|
71 |
subtitle = xml_caption_to_srt(response.read().decode()) if isSrt else response.read().decode()
|
72 |
print("url{}, title:{}, duration:{} len(subtitle): {}".format(url, title, duration, len(subtitle)))
|
73 |
+
return {"title": title, "duration": duration,"subtitle": subtitle, "chapters":info_dict.get("chapters", None) }
|
74 |
except Exception as e:
|
75 |
return {"error": str(e)}
|
76 |
return {"title": title, "duration": duration, "error": "No subtitles"}
|