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

Code before:
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://watch.thechosen.tv/video/184683621750',
        'info_dict': {
            'id': '184683621750',
            'ext': 'mp4',
            'title': 'Season 5 Episode 3:  Woes',
            'description': 'md5:90ca3cc41316a965fd1cd3d5b3458784',
            'duration': 3519,
            'thumbnail': 'https://cdn.thechosen.media/videos/cmkoltsl8000dfd5z3luid3mg/thumbnail.jpg',
        },
        'params': {'skip_download': 'm3u8'},
    }]
    _API_TMPL = 'https://api.watch.thechosen.tv/v1/videos/{}'

    def _real_extract(self, url):
        video_id = self._match_id(url)
        metadata = self._download_json(self._API_TMPL.format(video_id), video_id)

        formats, subtitles = [], {}
        video_data = traverse_obj(metadata, ('details', 'video'))
        for item in video_data:
            vurl = item.get('url')
            if not vurl:
                continue
            ext = determine_ext(vurl)
            if ext == 'm3u8':
                formats, subtitles = self._extract_m3u8_formats_and_subtitles(vurl, video_id)
                formats.extend(formats)
            elif ext == 'mpd':
                formats, subtitles = self._extract_mpd_formats_and_subtitles(vurl, video_id)
                subtitles.utend(formats)
                subtitles.update(subtitles)
            else:
                continue

        thumbnails = []
        if thumb_data := traverse_obj(metadata, ('thumbs'), ('thumbnails'), default=None):
            for _, thumb_url in thumb_data.items():
                if thumb_url is None:
                    continue
                thumbnails.append({'url': thumb_url})

        return {
            'id': video_id,
            **traverse_obj(metadata, ({
                'title': ('title'),
                'description': ('description'),
                'duration': ('duration'),
            })),

Review comment (suggestion):
if you're going to iterate over a `traverse_obj` result, then the the traversal path should be branching (either with `...` or `(('branch_a', 'branch_b'), 'common_key')` etc), which will ensure that `traverse_obj` returns a list.

Here, we are only using the `url` value, so we condense this:
```suggestion
        for vurl in traverse_obj(metadata, ('details', 'video', ..., 'url', {url_or_none}))::
```

Code after:
            'title': 'Season 5 Episode 2: House of Cards',
            'description': 'md5:55b389cbb4b7a01d8c2d837102905617',
            'duration': 3086,
            'thumbnail': 'https://cdn.thechosen.media/videos/cmkolt4el000afd5zd6x0aeph/thumbnail.jpg',
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://watch.thechosen.tv/video/184683621750',
        'info_dict': {
            'id': '184683621750',
            'ext': 'mp4',
            'title': 'Season 5 Episode 3:  Woes',
            'description': 'md5:90ca3cc41316a965fd1cd3d5b3458784',
            'duration': 3519,
            'thumbnail': 'https://cdn.thechosen.media/videos/cmkoltsl8000dfd5z3luid3mg/thumbnail.jpg',
        },
        'params': {'skip_download': 'm3u8'},
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        metadata = self._download_json(f'https://api.watch.thechosen.tv/v1/videos/{video_id}', video_id)

        formats, subtitles = [], {}
        for fmt_url in traverse_obj(metadata, ('details', 'video', ..., 'url', {url_or_none})):
            ext = determine_ext(fmt_url)
            if ext == 'm3u8':
                fmts, subs = self._extract_m3u8_formats_and_subtitles(fmt_url, video_id, 'mp4', fatal=False)
            elif ext == 'mpd':
                fmts, subs = self._extract_mpd_formats_and_subtitles(fmt_url, video_id, fatal=False)
            else:
                self.report_warning(f'Skipping unsupported format extension "{ext}"', video_id=video_id)
                continue
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)

        thumbnails = []
        for thumb_id, thumb_url in traverse_obj(metadata, (
            ('thumbs', 'thumbnails'), {dict.items}, lambda _, v: url_or_none(v[1]),
        )):
            thumbnails.append({
                'id': thumb_id,
                'url': thumb_url,
            })

        return {
            'id': video_id,
            **traverse_obj(metadata, ({
                'title': ('title', {str}),
                'description': ('description', {str}),
                'duration': ('duration', {int_or_none}),