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

Code before:
            'description': 'md5:6d00cd658394fa1a5071200d3ed4be05',
            'duration': 1419,
            'age_limit': 0,
            'comment_count': int,
            'upload_date': '20181003',
            'thumbnail': 'https://i.ytimg.com/vi_webp/yiDOExw2aSA/maxresdefault.webp',
            'availability': 'public',
            'playable_in_embed': True,
            'channel_id': 'UCKL5hAuzgFQsyrsQKgU0Qng',
            'title': 'More Than Words: Full Episode 80 (Finale)',
            'uploader_id': 'GMANETWORK',
            'categories': ['Entertainment'],
            'uploader': 'GMANetwork',
            'channel_url': 'https://www.youtube.com/channel/UCKL5hAuzgFQsyrsQKgU0Qng',
            'tags': 'count:29',
            'view_count': int,
            'uploader_url': 'http://www.youtube.com/user/GMANETWORK',
        }
    }]

    def _real_extract(self, url):
        content_id, display_id = self._match_valid_url(url).group('id', 'display_id')
        webpage = self._download_webpage(url, display_id)
        # webpage route
        youtube_id = self._search_regex(
            r'var\s*YOUTUBE_VIDEO\s*=\s*[\'"]+(?P<yt_id>\w+)', webpage, 'youtube_id')
        if youtube_id:
            return self.url_result(youtube_id, YoutubeIE, youtube_id)

        # api call route
        # more info at https://aphrodite.gmanetwork.com/fullepisodes/assets/fullepisodes/js/dist/fullepisodes_video.js?v=1.1.11
        network_url = self._search_regex(
            r'NETWORK_URL\s*=\s*[\'"](?P<url>[^\'"]+)', webpage, 'network_url')
        json_data = self._download_json(f'{network_url}api/data/content/video/{content_id}', display_id)
        if json_data.get('video_file'):
            return self.url_result(json_data['video_file'], YoutubeIE, json_data['video_file'])
        else:
            return self.url_result(json_data['dailymotion_file'], DailymotionIE, json_data['dailymotion_file'])


Review comment (suggestion):
regex fix + this should be non-fatal if we want to be able to use the API call route
```suggestion
        youtube_id = self._search_regex(
            r'var\s*YOUTUBE_VIDEO\s*=\s*[\'"]+(?P<yt_id>[\w-]+)', webpage, 'youtube_id', fatal=False)
```

Code after:
            'description': 'md5:6d00cd658394fa1a5071200d3ed4be05',
            'duration': 1419,
            'age_limit': 0,
            'comment_count': int,
            'upload_date': '20181003',
            'thumbnail': 'https://i.ytimg.com/vi_webp/yiDOExw2aSA/maxresdefault.webp',
            'availability': 'public',
            'playable_in_embed': True,
            'channel_id': 'UCKL5hAuzgFQsyrsQKgU0Qng',
            'title': 'More Than Words: Full Episode 80 (Finale)',
            'uploader_id': 'GMANETWORK',
            'categories': ['Entertainment'],
            'uploader': 'GMANetwork',
            'channel_url': 'https://www.youtube.com/channel/UCKL5hAuzgFQsyrsQKgU0Qng',
            'tags': 'count:29',
            'view_count': int,
            'uploader_url': 'http://www.youtube.com/user/GMANETWORK',
        }
    }]

    def _real_extract(self, url):
        content_id, display_id = self._match_valid_url(url).group('id', 'display_id')
        webpage = self._download_webpage(url, display_id)
        # webpage route
        youtube_id = self._search_regex(
            r'var\s*YOUTUBE_VIDEO\s*=\s*[\'"]+(?P<yt_id>[\w-]+)', webpage, 'youtube_id', fatal=False)
        if youtube_id:
            return self.url_result(youtube_id, YoutubeIE, youtube_id)

        # api call route
        # more info at https://aphrodite.gmanetwork.com/fullepisodes/assets/fullepisodes/js/dist/fullepisodes_video.js?v=1.1.11
        network_url = self._search_regex(
            r'NETWORK_URL\s*=\s*[\'"](?P<url>[^\'"]+)', webpage, 'network_url')
        json_data = self._download_json(f'{network_url}api/data/content/video/{content_id}', display_id)
        if json_data.get('video_file'):
            return self.url_result(json_data['video_file'], YoutubeIE, json_data['video_file'])
        else:
            return self.url_result(json_data['dailymotion_file'], DailymotionIE, json_data['dailymotion_file'])