diff --git a/yt_dlp/extractor/trtworld.py b/yt_dlp/extractor/trtworld.py index 8e1c261cf9..d82a749231 100644 --- a/yt_dlp/extractor/trtworld.py +++ b/yt_dlp/extractor/trtworld.py @@ -31,10 +31,23 @@ class TrtWorldIE(InfoExtractor): def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) - nuxtjs_data = self._search_nuxt_data(webpage, display_id) - video_url = traverse_obj(nuxtjs_data, ('videoData', 'content', 'platforms', 'website', 'metadata', 'hls_url', )) - published_date_str = traverse_obj(nuxtjs_data, ('videoData', 'content', 'published', 'date', )) - formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_url, display_id) + nuxtjs_data = self._search_nuxt_data(webpage, display_id)['videoData']['content'] + formats = [] + for media_url in traverse_obj(nuxtjs_data, ( + 'platforms', ('website', 'ott'), 'metadata', ('hls_url', 'url'), {url_or_none})): + # Website sometimes serves mp4 files under `hls_url` key + if media_url.endswith('.m3u8'): + formats.extend(self._extract_m3u8_formats(media_url, display_id, fatal=False)) + else: + formats.append({ + 'format_id': 'http', + 'url': media_url, + }) + if not formats: + if youtube_id := traverse_obj(nuxtjs_data, ('platforms', 'youtube', 'metadata', 'youtubeId')): + return self.url_result(youtube_id, 'Youtube') + raise ExtractorError('No video found', expected=True) + return { 'id': str(display_id), 'formats': formats,