From bd59a2a6571b5fdf77dcdfadd6768ea8ac6b4b53 Mon Sep 17 00:00:00 2001 From: CasperMcFadden95 <145611964+CasperMcFadden95@users.noreply.github.com> Date: Sun, 8 Jun 2025 11:56:34 +0000 Subject: [PATCH 1/5] [ie/FaulioLive] Add extractor --- yt_dlp/extractor/_extractors.py | 1 + yt_dlp/extractor/faulio.py | 97 +++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 yt_dlp/extractor/faulio.py diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index 34c98b537..00857b4aa 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -639,6 +639,7 @@ FancodeVodIE, ) from .fathom import FathomIE +from .faulio import FaulioLiveIE from .faz import FazIE from .fc2 import ( FC2IE, diff --git a/yt_dlp/extractor/faulio.py b/yt_dlp/extractor/faulio.py new file mode 100644 index 000000000..fc9032064 --- /dev/null +++ b/yt_dlp/extractor/faulio.py @@ -0,0 +1,97 @@ +import re + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.utils import ( + ExtractorError, + traverse_obj, +) + + +class FaulioLiveIE(InfoExtractor): + _VALID_URL = ( + r'https?://(?Paloula\.sba\.sa|maraya\.sba\.net\.ae)/' + r'(?:en/)?live/(?P[a-zA-Z0-9\-]+)' + ) + + _TESTS = [ + { + 'url': 'https://aloula.sba.sa/live/saudiatv', + 'info_dict': { + 'id': '2', + 'title': r're:قناة السعودية – البث المباشر \d{4}-\d{2}-\d{2} \d{2}:\d{2}', + 'description': 'البث المباشر لقناة السعودية، تابع أخبار المملكة وأهم الأحداث المحلية والعالمية، بالإضافة لبرامج اجتماعية وترفيهية منوعة', + 'ext': 'mp4', + 'live_status': 'is_live', + }, + }, + { + 'url': 'https://aloula.sba.sa/live/sbc-channel', + 'info_dict': { + 'id': '1', + 'title': r're:قناة SBC – البث المباشر \d{4}-\d{2}-\d{2} \d{2}:\d{2}', + 'description': 'البث المباشر لقناة SBC ، برامج منوعة وأعمال درامية وترفيهية سعودية وعربية على مدار الساعة.', + 'ext': 'mp4', + 'live_status': 'is_live', + }, + }, + { + 'url': 'https://maraya.sba.net.ae/live/1', + 'info_dict': { + 'id': '1', + 'title': r're:تلفزيون الشارقة \d{4}-\d{2}-\d{2} \d{2}:\d{2}', + 'description': 'تلفزيون الشارقة', + 'ext': 'mp4', + 'live_status': 'is_live', + }, + }, + { + 'url': 'https://maraya.sba.net.ae/live/14', + 'info_dict': { + 'id': '14', + 'title': r're:قناة الشارقة الرياضية 2 \d{4}-\d{2}-\d{2} \d{2}:\d{2}', + 'description': 'قناة الشارقة الرياضية 2', + 'ext': 'mp4', + 'live_status': 'is_live', + }, + }, + ] + + def _real_extract(self, url): + mobj = self._match_valid_url(url) + faulio_url = mobj.group('faulio_url') + + webpage = self._download_webpage(url, faulio_url) + + api_url_match = re.search(r'TRANSLATIONS_API_URL\s*:\s*"(https?://[^"]+)"', webpage) + if not api_url_match: + raise ExtractorError('Could not find TRANSLATIONS_API_URL in the page') + api_base = api_url_match.group(1) + + channels_json = self._download_json(f'{api_base}/channels', faulio_url) + + channel_json = next( + (c for c in channels_json if str(c.get('url')) == faulio_url), + None, + ) + if not channel_json: + raise ExtractorError(f'Channel "{faulio_url}" not found in API') + + hls_url = traverse_obj(channel_json, ('streams', 'hls')) + if not hls_url: + raise ExtractorError(f'HLS stream not found for channel "{faulio_url}"') + + domain = mobj.group('domain') + headers = { + 'Referer': f'https://{domain}/', + 'Origin': f'https://{domain}', + } + + return { + 'id': str(channel_json.get('id')), + 'title': channel_json.get('title'), + 'description': channel_json.get('description'), + 'formats': self._extract_m3u8_formats(hls_url, faulio_url, 'mp4', m3u8_id='hls', live=True, + headers=headers), + 'is_live': True, + 'http_headers': headers, + } From 8ac988ad0f48db3c7458768f140b4a6ad0797156 Mon Sep 17 00:00:00 2001 From: CasperMcFadden95 <145611964+CasperMcFadden95@users.noreply.github.com> Date: Wed, 18 Jun 2025 20:19:40 +0000 Subject: [PATCH 2/5] Update faulio.py --- yt_dlp/extractor/faulio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt_dlp/extractor/faulio.py b/yt_dlp/extractor/faulio.py index fc9032064..9bf5e9a73 100644 --- a/yt_dlp/extractor/faulio.py +++ b/yt_dlp/extractor/faulio.py @@ -9,7 +9,7 @@ class FaulioLiveIE(InfoExtractor): _VALID_URL = ( - r'https?://(?Paloula\.sba\.sa|maraya\.sba\.net\.ae)/' + r'https?://(?Paloula\.sba\.sa|maraya\.sba\.net\.ae|sat7plus\.org)/' r'(?:en/)?live/(?P[a-zA-Z0-9\-]+)' ) From e8c9fbc1f093ba0d7b72b403eb481255df327e99 Mon Sep 17 00:00:00 2001 From: CasperMcFadden95 <145611964+CasperMcFadden95@users.noreply.github.com> Date: Sun, 22 Jun 2025 20:07:17 +0000 Subject: [PATCH 3/5] Update faulio.py --- yt_dlp/extractor/faulio.py | 75 ++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/yt_dlp/extractor/faulio.py b/yt_dlp/extractor/faulio.py index 9bf5e9a73..f656156f4 100644 --- a/yt_dlp/extractor/faulio.py +++ b/yt_dlp/extractor/faulio.py @@ -1,7 +1,7 @@ import re -from yt_dlp.extractor.common import InfoExtractor -from yt_dlp.utils import ( +from .common import InfoExtractor +from ..utils import ( ExtractorError, traverse_obj, ) @@ -13,48 +13,43 @@ class FaulioLiveIE(InfoExtractor): r'(?:en/)?live/(?P[a-zA-Z0-9\-]+)' ) - _TESTS = [ - { - 'url': 'https://aloula.sba.sa/live/saudiatv', - 'info_dict': { - 'id': '2', - 'title': r're:قناة السعودية – البث المباشر \d{4}-\d{2}-\d{2} \d{2}:\d{2}', - 'description': 'البث المباشر لقناة السعودية، تابع أخبار المملكة وأهم الأحداث المحلية والعالمية، بالإضافة لبرامج اجتماعية وترفيهية منوعة', - 'ext': 'mp4', - 'live_status': 'is_live', - }, + _TESTS = [{ + 'url': 'https://aloula.sba.sa/live/saudiatv', + 'info_dict': { + 'id': '2', + 'title': str, + 'description': str, + 'ext': 'mp4', + 'live_status': 'is_live', }, - { - 'url': 'https://aloula.sba.sa/live/sbc-channel', - 'info_dict': { - 'id': '1', - 'title': r're:قناة SBC – البث المباشر \d{4}-\d{2}-\d{2} \d{2}:\d{2}', - 'description': 'البث المباشر لقناة SBC ، برامج منوعة وأعمال درامية وترفيهية سعودية وعربية على مدار الساعة.', - 'ext': 'mp4', - 'live_status': 'is_live', - }, + }, { + 'url': 'https://aloula.sba.sa/live/sbc-channel', + 'info_dict': { + 'id': '1', + 'title': str, + 'description': str, + 'ext': 'mp4', + 'live_status': 'is_live', }, - { - 'url': 'https://maraya.sba.net.ae/live/1', - 'info_dict': { - 'id': '1', - 'title': r're:تلفزيون الشارقة \d{4}-\d{2}-\d{2} \d{2}:\d{2}', - 'description': 'تلفزيون الشارقة', - 'ext': 'mp4', - 'live_status': 'is_live', - }, + }, { + 'url': 'https://maraya.sba.net.ae/live/1', + 'info_dict': { + 'id': '1', + 'title': str, + 'description': str, + 'ext': 'mp4', + 'live_status': 'is_live', }, - { - 'url': 'https://maraya.sba.net.ae/live/14', - 'info_dict': { - 'id': '14', - 'title': r're:قناة الشارقة الرياضية 2 \d{4}-\d{2}-\d{2} \d{2}:\d{2}', - 'description': 'قناة الشارقة الرياضية 2', - 'ext': 'mp4', - 'live_status': 'is_live', - }, + }, { + 'url': 'https://maraya.sba.net.ae/live/14', + 'info_dict': { + 'id': '14', + 'title': str, + 'description': str, + 'ext': 'mp4', + 'live_status': 'is_live', }, - ] + }] def _real_extract(self, url): mobj = self._match_valid_url(url) From 9640816f3966805945a80a78ac60158717426aad Mon Sep 17 00:00:00 2001 From: CasperMcFadden95 <145611964+CasperMcFadden95@users.noreply.github.com> Date: Sun, 22 Jun 2025 20:22:30 +0000 Subject: [PATCH 4/5] Update faulio.py --- yt_dlp/extractor/faulio.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/yt_dlp/extractor/faulio.py b/yt_dlp/extractor/faulio.py index f656156f4..b7ddf769a 100644 --- a/yt_dlp/extractor/faulio.py +++ b/yt_dlp/extractor/faulio.py @@ -22,6 +22,9 @@ class FaulioLiveIE(InfoExtractor): 'ext': 'mp4', 'live_status': 'is_live', }, + 'params': { + 'skip_download': 'Livestream', + }, }, { 'url': 'https://aloula.sba.sa/live/sbc-channel', 'info_dict': { @@ -31,6 +34,9 @@ class FaulioLiveIE(InfoExtractor): 'ext': 'mp4', 'live_status': 'is_live', }, + 'params': { + 'skip_download': 'Livestream', + }, }, { 'url': 'https://maraya.sba.net.ae/live/1', 'info_dict': { @@ -40,6 +46,9 @@ class FaulioLiveIE(InfoExtractor): 'ext': 'mp4', 'live_status': 'is_live', }, + 'params': { + 'skip_download': 'Livestream', + }, }, { 'url': 'https://maraya.sba.net.ae/live/14', 'info_dict': { @@ -49,6 +58,9 @@ class FaulioLiveIE(InfoExtractor): 'ext': 'mp4', 'live_status': 'is_live', }, + 'params': { + 'skip_download': 'Livestream', + }, }] def _real_extract(self, url): From fc08114f28f64ba22fea023162fa5a761bea5114 Mon Sep 17 00:00:00 2001 From: CasperMcFadden95 <145611964+CasperMcFadden95@users.noreply.github.com> Date: Mon, 23 Jun 2025 21:05:43 +0000 Subject: [PATCH 5/5] Update yt_dlp/extractor/faulio.py Co-authored-by: doe1080 <98906116+doe1080@users.noreply.github.com> --- yt_dlp/extractor/faulio.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/faulio.py b/yt_dlp/extractor/faulio.py index b7ddf769a..6bfe345b4 100644 --- a/yt_dlp/extractor/faulio.py +++ b/yt_dlp/extractor/faulio.py @@ -1,10 +1,8 @@ import re from .common import InfoExtractor -from ..utils import ( - ExtractorError, - traverse_obj, -) +from ..utils import ExtractorError +from ..utils.traversal import traverse_obj class FaulioLiveIE(InfoExtractor):