diff --git a/StreamingCommunity/Lib/Downloader/HLS/downloader.py b/StreamingCommunity/Lib/Downloader/HLS/downloader.py index 38572c1..d42a35d 100644 --- a/StreamingCommunity/Lib/Downloader/HLS/downloader.py +++ b/StreamingCommunity/Lib/Downloader/HLS/downloader.py @@ -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 diff --git a/StreamingCommunity/Util/os.py b/StreamingCommunity/Util/os.py index eda0b38..ad2a536 100644 --- a/StreamingCommunity/Util/os.py +++ b/StreamingCommunity/Util/os.py @@ -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: diff --git a/config.json b/config.json index a536aab..70a729e 100644 --- a/config.json +++ b/config.json @@ -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 },