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

Code before:
)

_LANGUAGES = (
    'ar',
    'en',
    'fa',
)


class FaulioBase(InfoExtractor):
    def _get_headers(self, url):
        origin = f'{urllib.parse.urlparse(url).scheme}://{urllib.parse.urlparse(url).netloc}'
        return {
            'Referer': origin,
            'Origin': origin,
        }

    def _get_api_base(self, url, video_id):
        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)
        return config_data['public']['TRANSLATIONS_API_URL']


class FaulioIE(FaulioBase):
    _VALID_URL = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:{"|".join(map(re.escape, _LANGUAGES))})/)?(?:episode|media)/(?P<id>[a-zA-Z0-9-]+)'
    _TESTS = [
        {
            'url': 'https://bahry.com/en/media/1191',
            'info_dict': {
                'id': 'bahry.faulio.com_1191',
                'ext': 'mp4',
                'display_id': 'Episode-4-1191',
                'title': 'Episode 4',
                'episode': 'Episode 4',
                'description': '',
                'series': 'Wild Water',
                'season': 'Season 1',
                'season_number': 1,
                'episode_number': 4,
                'thumbnail': str,
                'duration': 1653,
                'age_limit': 0,
            },
        },
        {
            'url': 'https://maraya.sba.net.ae/en/episode/127735',
            'info_dict': {
                'id': 'maraya.faulio.com_127735',
                'ext': 'mp4',
                'display_id': 'عبدالله-الهاجري---عبدالرحمن-المطروشي-127735',

Review comment (suggestion):
```suggestion
    _VALID_URL = fr'{FaulioBaseIE._BASE_URL_RE}(?:episode|media)/(?P<id>[a-zA-Z0-9-]+)'
```

Code after:
        'maraya.sba.net.ae',
        'sat7plus.org',
    )
    _LANGUAGES = ('ar', 'en', 'fa')
    _BASE_URL_RE = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:{"|".join(_LANGUAGES)})/)?'

    def _get_headers(self, url):
        parsed_url = urllib.parse.urlparse(url)
        return {
            'Referer': url,
            'Origin': f'{parsed_url.scheme}://{parsed_url.hostname}',
        }

    def _get_api_base(self, url, video_id):
        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)
        return config_data['public']['TRANSLATIONS_API_URL']


class FaulioIE(FaulioBaseIE):
    _VALID_URL = fr'{FaulioBaseIE._BASE_URL_RE}(?:episode|media)/(?P<id>[a-zA-Z0-9-]+)'
    _TESTS = [{
        'url': 'https://aloula.sba.sa/en/episode/29102',
        'info_dict': {
            'id': 'aloula.faulio.com_29102',
            'ext': 'mp4',
            'display_id': 'هذا-مكانك-03-004-v-29102',
            'title': 'الحلقة 4',
            'episode': 'الحلقة 4',
            'description': '',
            'series': 'هذا مكانك',
            'season': 'Season 3',
            'season_number': 3,
            'episode_number': 4,
            'thumbnail': r're:^https?://.*\.jpg$',
            'duration': 4855,
            'age_limit': 3,
        },
    }, {
        'url': 'https://bahry.com/en/media/1191',
        'info_dict': {
            'id': 'bahry.faulio.com_1191',
            'ext': 'mp4',
            'display_id': 'Episode-4-1191',
            'title': 'Episode 4',
            'episode': 'Episode 4',
            'description': '',
            'series': 'Wild Water',
            'season': 'Season 1',
            'season_number': 1,