From 2462c339692eac54c3186a9865706c953d3e2a2c Mon Sep 17 00:00:00 2001 From: stvoidit <43279538+stvoidit@users.noreply.github.com> Date: Sun, 8 Feb 2026 09:38:11 +0300 Subject: [PATCH] =?UTF-8?q?If=20there=20are=20no=20new=20links,=20there's?= =?UTF-8?q?=20no=20point=20in=20spamming=20requests=20=E2=80=93=20let's=20?= =?UTF-8?q?be=20restrained.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- streamonitor/downloaders/hls.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/streamonitor/downloaders/hls.py b/streamonitor/downloaders/hls.py index 3ca35833..96cf4241 100644 --- a/streamonitor/downloaders/hls.py +++ b/streamonitor/downloaders/hls.py @@ -31,7 +31,7 @@ def getVideoNativeHLS(self, url, filename, m3u_processor=None): def execute(): nonlocal error - downloaded_list = [] + downloaded_list: set[str] = set() with open(tmpfilename, 'wb') as outfile: did_download = False while not self.stopDownloadFlag: @@ -42,12 +42,13 @@ def execute(): chunklist = m3u8.loads(content) if len(chunklist.segments) == 0: return - for chunk in chunklist.segment_map + chunklist.segments: - if chunk.uri in downloaded_list: - continue + all_segments = chunklist.segment_map + chunklist.segments + chunks = [chunk.uri for chunk in all_segments if chunk.uri and chunk.uri not in downloaded_list] + if not chunks: + sleep(1) + for chunk_uri in chunks: did_download = True - downloaded_list.append(chunk.uri) - chunk_uri = chunk.uri + downloaded_list.add(chunk_uri) self.debug('Downloading ' + chunk_uri) if not chunk_uri.startswith("https://"): chunk_uri = '/'.join(url.split('.m3u8')[0].split('/')[:-1]) + '/' + chunk_uri