Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/faulio.py (Python)

Code before:
            'skip_download': 'Livestream',
        },
    }, {
        'url': 'https://maraya.sba.net.ae/live/14',
        'info_dict': {
            'id': '14',
            'title': str,
            'description': str,
            'ext': 'mp4',
            'live_status': 'is_live',
        },
        'params': {
            'skip_download': 'Livestream',
        },
    }]

    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,

Review comment (suggestion):
I'd parse the entire NUXT config
```suggestion
        config_data = self._search_json(
            r'window\.__NUXT__\.config=', webpage, 'config', video_id, transform_source=js_to_json)
        api_base = config_data['public']['TRANSLATIONS_API_URL']
```

Code after:
        },
        'params': {
            'skip_download': 'Livestream',
        },
    }, {
        'url': 'https://sat7plus.org/fa/live/arabic',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)

        config_data = self._search_json(
            r'window\.__NUXT__\.config=', webpage, 'config', video_id, transform_source=js_to_json)
        api_base = config_data['public']['TRANSLATIONS_API_URL']

        channel = traverse_obj(
            self._download_json(f'{api_base}/channels', video_id),
            (lambda k, v: v['url'] == video_id, any))

        formats = []
        subtitles = {}
        if hls_url := traverse_obj(channel, ('streams', 'hls', {url_or_none})):
            fmts, subs = self._extract_m3u8_formats_and_subtitles(
                hls_url, video_id, 'mp4', m3u8_id='hls', live=True, fatal=False)
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)

        if mpd_url := traverse_obj(channel, ('streams', 'mpd', {url_or_none})):
            fmts, subs = self._extract_mpd_formats_and_subtitles(
                mpd_url, video_id, mpd_id='dash', fatal=False)
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)

        return {
            'id': f'{urllib.parse.urlparse(api_base).hostname}_{video_id}',
            **traverse_obj(channel, {
                'title': ('title', {str}),
                'description': ('description', {str}),
            }),
            'formats': formats,
            'subtitles': subtitles,
            'is_live': True,
        }