lanbogao commited on
Commit
860b5e0
1 Parent(s): 0d59eb5

Add chapters.

Browse files
Files changed (1) hide show
  1. 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"}