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