Update segments.py

This commit is contained in:
ciccioxm3 2025-06-26 11:28:37 +02:00 committed by GitHub
parent 15b168503a
commit f296311d64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -110,7 +110,7 @@ class M3U8_Segments:
self.key_base_url = f"{parsed_url.scheme}://{parsed_url.netloc}/" self.key_base_url = f"{parsed_url.scheme}://{parsed_url.netloc}/"
try: try:
client_params = {'headers': {'User-Agent': get_userAgent()}, 'timeout': MAX_TIMEOOUT} client_params = {'headers': {'User-Agent': get_userAgent()}, 'timeout': MAX_TIMEOOUT, 'verify': REQUEST_VERIFY}
response = httpx.get(url=key_uri, **client_params) response = httpx.get(url=key_uri, **client_params)
response.raise_for_status() response.raise_for_status()
@ -158,7 +158,7 @@ class M3U8_Segments:
""" """
if self.is_index_url: if self.is_index_url:
try: try:
client_params = {'headers': {'User-Agent': get_userAgent()}, 'timeout': MAX_TIMEOOUT} client_params = {'headers': {'User-Agent': get_userAgent()}, 'timeout': MAX_TIMEOOUT, 'verify': REQUEST_VERIFY}
response = httpx.get(self.url, **client_params, follow_redirects=True) response = httpx.get(self.url, **client_params, follow_redirects=True)
response.raise_for_status() response.raise_for_status()
@ -202,7 +202,8 @@ class M3U8_Segments:
'headers': {'User-Agent': get_userAgent()}, 'headers': {'User-Agent': get_userAgent()},
'timeout': SEGMENT_MAX_TIMEOUT, 'timeout': SEGMENT_MAX_TIMEOUT,
'follow_redirects': True, 'follow_redirects': True,
'http2': False 'http2': False,
'verify': REQUEST_VERIFY
} }
return httpx.Client(**client_params) return httpx.Client(**client_params)
@ -463,4 +464,4 @@ class M3U8_Segments:
f"[white]Failed segments: [red]{self.info_nFailed}") f"[white]Failed segments: [red]{self.info_nFailed}")
if self.info_nRetry > len(self.segments) * 0.3: if self.info_nRetry > len(self.segments) * 0.3:
console.print("[yellow]Warning: High retry count detected. Consider reducing worker count in config.") console.print("[yellow]Warning: High retry count detected. Consider reducing worker count in config.")