lanbogao commited on
Commit
8a3c63b
1 Parent(s): 6322226

1. Set socket_timeout default 10 and set 20 when proxy.

Browse files

2. extractor_retries to 0
3. extract youtube by android only.

Files changed (1) hide show
  1. fetchYoutubeSubtitle.py +13 -3
fetchYoutubeSubtitle.py CHANGED
@@ -46,11 +46,19 @@ async def fetchSubtitlebyType(url: str, lang: Optional[str] = 'en', subType: Opt
46
  "allsubtitles": True,
47
  "subtitleslangs": [lang] if lang else [],
48
  "skip_download": True,
49
- "socket_timeout": 20
 
 
 
 
 
 
 
 
50
  }
51
 
52
  if proxy:
53
- ydl_opts.update({"proxy": proxy})
54
 
55
  title = "unknow"
56
  duration = ""
@@ -122,9 +130,11 @@ async def fetchSubtitleUrls(url: str, proxy: Optional[str] = None) -> json:
122
  "writesubtitles": False,
123
  "allsubtitles": True,
124
  "skip_download": True,
 
 
125
  }
126
  if proxy:
127
- ydl_opts.update({"proxy": proxy})
128
 
129
  title = "unknow"
130
  duration = ""
 
46
  "allsubtitles": True,
47
  "subtitleslangs": [lang] if lang else [],
48
  "skip_download": True,
49
+ "socket_timeout": 10,
50
+ "extractor_retries": 0,
51
+ "extractor_args": {
52
+ "youtube": {
53
+ "player_skip": ["webpage", "configs", "initial"],
54
+ "player_client": ["android"],
55
+ "skip": ["hls", "dash", "translated_subs"],
56
+ }
57
+ },
58
  }
59
 
60
  if proxy:
61
+ ydl_opts.update({"proxy": proxy, "socket_timeout": 20})
62
 
63
  title = "unknow"
64
  duration = ""
 
130
  "writesubtitles": False,
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})
138
 
139
  title = "unknow"
140
  duration = ""