mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-07-20 00:50:10 +00:00
Fix subtitle vtt download
This commit is contained in:
parent
335d97ec2d
commit
83b39f8664
@ -283,11 +283,17 @@ class DownloadManager:
|
||||
if self.stopped:
|
||||
return True
|
||||
|
||||
content = self.client.request(sub['uri'])
|
||||
if content:
|
||||
raw_content = self.client.request(sub['uri'])
|
||||
if raw_content:
|
||||
sub_path = os.path.join(self.temp_dir, 'subs', f"{sub['language']}.vtt")
|
||||
with open(sub_path, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
subtitle_parser = M3U8_Parser()
|
||||
subtitle_parser.parse_data(sub['uri'], raw_content)
|
||||
|
||||
with open(sub_path, 'wb') as f:
|
||||
vtt_url = subtitle_parser.subtitle[-1]
|
||||
vtt_content = self.client.request(vtt_url, True)
|
||||
f.write(vtt_content)
|
||||
|
||||
return self.stopped
|
||||
|
||||
|
@ -287,12 +287,12 @@ class InternManager():
|
||||
def check_internet():
|
||||
while True:
|
||||
try:
|
||||
httpx.get("https://www.google.com", timeout=15)
|
||||
httpx.get("https://www.google.com", timeout=5)
|
||||
break
|
||||
|
||||
except urllib.error.URLError:
|
||||
except Exception as e:
|
||||
console.log("[bold red]Internet is not available. Waiting...[/bold red]")
|
||||
time.sleep(5)
|
||||
time.sleep(2)
|
||||
|
||||
|
||||
class OsSummary:
|
||||
|
@ -22,7 +22,7 @@
|
||||
"telegram_bot": false
|
||||
},
|
||||
"REQUESTS": {
|
||||
"timeout": 25,
|
||||
"timeout": 20,
|
||||
"max_retry": 8,
|
||||
"proxy_start_min": 0.1,
|
||||
"proxy_start_max": 0.5
|
||||
@ -40,8 +40,8 @@
|
||||
"download_subtitle": true,
|
||||
"merge_subs": true,
|
||||
"specific_list_subtitles": [
|
||||
"eng",
|
||||
"spa"
|
||||
"ita",
|
||||
"eng"
|
||||
],
|
||||
"cleanup_tmp_folder": true
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user