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

Code before:
            'ext': 'mp4',
            'title': 'James Bulger: The New Revelations',
            'description': 'md5:7b97922038bad1d0fe8d0470d8a189f2',
            'duration': 2640.0,
            'age_limit': 0,
            'tags': ['Investigation', 'True Crime', 'Justice', 'Europe'],
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://www.magellantv.com/watch/celebration-nation',
        'info_dict': {
            'id': 'celebration-nation',
            'ext': 'mp4',
            'tags': ['Art & Culture', 'Human Interest', 'Anthropology', 'China', 'History'],
            'duration': 2640.0,
            'title': 'Ancestors',
        },
        'params': {'skip_download': 'm3u8'},
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)
        data = traverse_obj(self._search_nextjs_data(webpage, video_id), (
            'props', 'pageProps', 'reactContext',
            (('video', 'detail'), ('series', 'currentEpisode'))), get_all=False)
        formats, subtitles = self._extract_m3u8_formats_and_subtitles(data['jwpVideoUrl'], video_id)

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(data, {
                'title': ('title', {str}),
                'description': ('metadata', 'description', {str}),
                'duration': ('duration', {parse_duration}),
                'age_limit': ('ratingCategory', {parse_age_limit}),
                'tags': ('tags', ..., {str}),
            }),
        }


Review comment (suggestion):
I'd do this but it probably doesn't matter
```suggestion
            (('video', 'detail'), ('series', 'currentEpisode')), {dict}), get_all=False)
```

Code after:
            'ext': 'mp4',
            'title': 'James Bulger: The New Revelations',
            'description': 'md5:7b97922038bad1d0fe8d0470d8a189f2',
            'duration': 2640.0,
            'age_limit': 0,
            'tags': ['Investigation', 'True Crime', 'Justice', 'Europe'],
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://www.magellantv.com/watch/celebration-nation',
        'info_dict': {
            'id': 'celebration-nation',
            'ext': 'mp4',
            'tags': ['Art & Culture', 'Human Interest', 'Anthropology', 'China', 'History'],
            'duration': 2640.0,
            'title': 'Ancestors',
        },
        'params': {'skip_download': 'm3u8'},
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)
        data = traverse_obj(self._search_nextjs_data(webpage, video_id), (
            'props', 'pageProps', 'reactContext',
            (('video', 'detail'), ('series', 'currentEpisode')), {dict}), get_all=False)
        formats, subtitles = self._extract_m3u8_formats_and_subtitles(data['jwpVideoUrl'], video_id)

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(data, {
                'title': ('title', {str}),
                'description': ('metadata', 'description', {str}),
                'duration': ('duration', {parse_duration}),
                'age_limit': ('ratingCategory', {parse_age_limit}),
                'tags': ('tags', ..., {str}),
            }),
        }