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

Code before:
            'upload_date': '20250323',
            'episode': 'DEx 08x30 Rostros del mal: Los asesinos en serie que aterrorizaron España',
            'duration': 11837,
            'tags': ['españa', 'asesinos en serie', 'arropiero', 'historia criminal', 'mataviejas'],
        },
    }, {
        'url': 'https://go.ivoox.com/rf/143594959',
        'only_matching': True,
    }, {
        'url': 'https://www.ivoox.com/en/campodelgas-28-03-2025-audios-mp3_rf_144036942_1.html',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        media_id = self._match_id(url)
        webpage = self._download_webpage(url, media_id)

        data = traverse_obj(self._search_nuxt_data(webpage, media_id), ('data', 'audio'))

        direct_download = self._download_json(
            f'https://vcore-web.ivoox.com/v1/public/audios/{media_id}/download-url', media_id, fatal=False,
            note='Fetching direct download link', headers={'Referer': url})

        download_paths = {
            traverse_obj(direct_download, ('data', 'downloadUrl', {str})),
            *traverse_obj(data, (('downloadUrl', 'mediaUrl'), {str}, all))}

        formats = []
        for path in traverse_obj(download_paths, (..., {str})):
            formats.append({
                'url': urljoin('https://ivoox.com', path),
                'http_headers': {'Referer': url},
            })

        return {
            'id': media_id,
            'formats': formats,
            'uploader': self._html_search_regex(r'data-prm-author="([^"]+)"', webpage, 'author', default=None),
            'timestamp': parse_iso8601(self._html_search_regex(r'data-prm-pubdate="([^"]+)"', webpage, 'timestamp', default=None)),
            'channel': self._html_search_regex(r'data-prm-podname="([^"]+)"', webpage, 'channel', default=None),
            'title': self._html_search_regex(r'data-prm-title="([^"]+)"', webpage, 'title', default=None),
            'thumbnail': self._og_search_thumbnail(webpage),
            'description': self._og_search_description(webpage),
            **self._search_json_ld(webpage, media_id, fatal=False),
            **traverse_obj(data, {
                'title': ('title', {str}),
                'description': ('description', {str}),
                'thumbnail': ('image', {url_or_none}),
                'timestamp': ('uploadDate', {parse_iso8601(delimiter=' ')}),
                'duration': ('duration', {int_or_none}),
                'tags': ('tags', ..., 'name', {str}),

Review comment (suggestion):
2nd traversal is already branching and will return a `list` so we don't need `all`
```suggestion
        download_paths = {
            traverse_obj(direct_download, ('data', 'downloadUrl', {str})),
            *traverse_obj(data, (('downloadUrl', 'mediaUrl'), {str})),
        }
```

Code after:
            'upload_date': '20250323',
            'episode': 'DEx 08x30 Rostros del mal: Los asesinos en serie que aterrorizaron España',
            'duration': 11837,
            'tags': ['españa', 'asesinos en serie', 'arropiero', 'historia criminal', 'mataviejas'],
        },
    }, {
        'url': 'https://go.ivoox.com/rf/143594959',
        'only_matching': True,
    }, {
        'url': 'https://www.ivoox.com/en/campodelgas-28-03-2025-audios-mp3_rf_144036942_1.html',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        media_id = self._match_id(url)
        webpage = self._download_webpage(url, media_id, fatal=False)

        data = self._search_nuxt_data(
            webpage, media_id, fatal=False, traverse=('data', 0, 'data', 'audio'))

        direct_download = self._download_json(
            f'https://vcore-web.ivoox.com/v1/public/audios/{media_id}/download-url', media_id, fatal=False,
            note='Fetching direct download link', headers={'Referer': url})

        download_paths = {
            *traverse_obj(direct_download, ('data', 'downloadUrl', {str}, filter, all)),
            *traverse_obj(data, (('downloadUrl', 'mediaUrl'), {str}, filter)),
        }

        formats = []
        for path in download_paths:
            formats.append({
                'url': urljoin('https://ivoox.com', path),
                'http_headers': {'Referer': url},
            })

        return {
            'id': media_id,
            'formats': formats,
            'uploader': self._html_search_regex(r'data-prm-author="([^"]+)"', webpage, 'author', default=None),
            'timestamp': parse_iso8601(
                self._html_search_regex(r'data-prm-pubdate="([^"]+)"', webpage, 'timestamp', default=None)),
            'channel': self._html_search_regex(r'data-prm-podname="([^"]+)"', webpage, 'channel', default=None),
            'title': self._html_search_regex(r'data-prm-title="([^"]+)"', webpage, 'title', default=None),
            'thumbnail': self._og_search_thumbnail(webpage, default=None),
            'description': self._og_search_description(webpage, default=None),
            **self._search_json_ld(webpage, media_id, default={}),
            **traverse_obj(data, {
                'title': ('title', {str}),
                'description': ('description', {str}),
                'thumbnail': ('image', {url_or_none}),