1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-27 17:08:32 +00:00

Update dzsecurity.py

This commit is contained in:
CasperMcFadden95 2025-06-18 17:49:26 +00:00 committed by GitHub
parent d7377707e8
commit 3bfd03416a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,7 @@
import re
from yt_dlp.extractor.common import InfoExtractor
from yt_dlp.utils import ExtractorError
import re
from urllib.parse import urlparse
class DzsecurityLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(echoroukonline|ennaharonline)\.com/live(?:-news)?'
@ -41,8 +40,11 @@ def _real_extract(self, url):
player_url = player_url_match.group(0)
stream_id = player_url_match.group(1)
parsed = urlparse(url)
base_url = f'{parsed.scheme}://{parsed.netloc}'
base_url_match = re.match(r'(https?://[^/]+)', url)
if not base_url_match:
raise ExtractorError("Failed to extract base URL from input URL")
base_url = base_url_match.group(1)
headers = {
'Referer': base_url,
@ -57,7 +59,7 @@ def _real_extract(self, url):
if not m3u8_match:
raise ExtractorError("M3U8 stream URL not found in player page")
m3u8_url = parsed.scheme + ':' + m3u8_match.group('url')
m3u8_url = 'https:' + m3u8_match.group('url')
return {
'id': stream_id,