Spaces:
Sleeping
Sleeping
Fix missing some langs.
Browse files- fetchYoutubeSubtitle.py +10 -2
fetchYoutubeSubtitle.py
CHANGED
@@ -50,7 +50,7 @@ async def fetchSubtitlebyType(url: str, lang: Optional[str] = 'en', subType: Opt
|
|
50 |
"extractor_retries": 0,
|
51 |
"extractor_args": {
|
52 |
"youtube": {
|
53 |
-
"player_skip": ["
|
54 |
"player_client": ["android"],
|
55 |
"skip": ["hls", "dash", "translated_subs"],
|
56 |
}
|
@@ -73,6 +73,7 @@ async def fetchSubtitlebyType(url: str, lang: Optional[str] = 'en', subType: Opt
|
|
73 |
subType = "xml"
|
74 |
isSrt = True
|
75 |
|
|
|
76 |
for subtitle_item in ["subtitles", "automatic_captions"]: # "requested_subtitles" item is dict
|
77 |
if info_dict.get(subtitle_item):
|
78 |
subtitle_url = getUrlFromSubtitles(info_dict.get(subtitle_item), lang, subType)
|
@@ -131,7 +132,14 @@ async def fetchSubtitleUrls(url: str, proxy: Optional[str] = None) -> json:
|
|
131 |
"allsubtitles": True,
|
132 |
"skip_download": True,
|
133 |
"socket_timeout": 10,
|
134 |
-
"extractor_retries": 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
if proxy:
|
137 |
ydl_opts.update({"proxy": proxy, "socket_timeout": 20})
|
|
|
50 |
"extractor_retries": 0,
|
51 |
"extractor_args": {
|
52 |
"youtube": {
|
53 |
+
"player_skip": ["configs", "initial"], # "webpage",
|
54 |
"player_client": ["android"],
|
55 |
"skip": ["hls", "dash", "translated_subs"],
|
56 |
}
|
|
|
73 |
subType = "xml"
|
74 |
isSrt = True
|
75 |
|
76 |
+
# print("subtitles.keys(): {} automatic_captions: {}".format( info_dict.get("subtitles").keys(),info_dict.get("automatic_captions").keys()))
|
77 |
for subtitle_item in ["subtitles", "automatic_captions"]: # "requested_subtitles" item is dict
|
78 |
if info_dict.get(subtitle_item):
|
79 |
subtitle_url = getUrlFromSubtitles(info_dict.get(subtitle_item), lang, subType)
|
|
|
132 |
"allsubtitles": True,
|
133 |
"skip_download": True,
|
134 |
"socket_timeout": 10,
|
135 |
+
"extractor_retries": 0,
|
136 |
+
# "extractor_args": {
|
137 |
+
# "youtube": {
|
138 |
+
# "player_skip": ["webpage", "configs", "initial"],
|
139 |
+
# "player_client": ["android"],
|
140 |
+
# "skip": ["hls", "dash", "translated_subs"],
|
141 |
+
# }
|
142 |
+
# },
|
143 |
}
|
144 |
if proxy:
|
145 |
ydl_opts.update({"proxy": proxy, "socket_timeout": 20})
|