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

Code before:
        return {
            'id': video_id,
            'title': title,
            'description': self._og_search_description(webpage),
            'channel': channel,
            'channel_id': channel_id,
            'channel_url': channel_url,
            'url': self._mave_link(webpage, video_id),
            'thumbnail': self._og_search_thumbnail(webpage),
        }

    def _mave_link(self, webpage, video_id):
        data = get_element_by_id('__NUXT_DATA__', webpage)

        jdata = json.loads(data)

        for value in jdata:
            if isinstance(value, str):
                if value.endswith('.mp3'):
                    link_id = value
                    break

        if link_id is None:
            raise ExtractorError('Unable to find mp3 file link', video_id=video_id)

        return 'https://api.mave.digital/' + link_id


Review comment (suggestion):
If my next couple suggestions are applied, we won't need any of this (it has been obsoleted by `_search_nuxt_json`). However, we should move the API URL to a class constant
```suggestion
```

Code after:
            'duration': 3664,
            'thumbnail': r're:https://.+/storage/podcasts/.+\.jpg',
            'series': 'Все там будем',
            'series_id': 'fe9347bf-c009-4ebd-87e8-b06f2f324746',
            'season': 'Season 2',
            'season_number': 2,
            'episode': 'Episode 5',
            'episode_number': 5,
            'timestamp': 1735538400,
            'upload_date': '20241230',
        },
    }]
    _API_BASE_URL = 'https://api.mave.digital/'

    def _real_extract(self, url):
        channel_id, slug = self._match_valid_url(url).group('channel', 'id')
        display_id = f'{channel_id}-{slug}'
        webpage = self._download_webpage(url, display_id)
        data = traverse_obj(
            self._search_nuxt_json(webpage, display_id),
            ('data', lambda _, v: v['activeEpisodeData'], any, {require('podcast data')}))

        return {
            'display_id': display_id,
            'channel_id': channel_id,
            'channel_url': f'https://{channel_id}.mave.digital/',
            'vcodec': 'none',
            'thumbnail': re.sub(r'_\d+(?=\.(?:jpg|png))', '', self._og_search_thumbnail(webpage, default='')) or None,
            **traverse_obj(data, ('activeEpisodeData', {
                'url': ('audio', {urljoin(self._API_BASE_URL)}),
                'id': ('id', {str}),
                'title': ('title', {str}),
                'description': ('description', {clean_html}),
                'duration': ('duration', {int_or_none}),
                'season_number': ('season', {int_or_none}),
                'episode_number': ('number', {int_or_none}),
                'view_count': ('listenings', {int_or_none}),
                'like_count': ('reactions', lambda _, v: v['type'] == 'like', 'count', {int_or_none}, any),
                'dislike_count': ('reactions', lambda _, v: v['type'] == 'dislike', 'count', {int_or_none}, any),
                'age_limit': ('is_explicit', {bool}, {lambda x: 18 if x else None}),
                'timestamp': ('publish_date', {parse_iso8601}),
            })),
            **traverse_obj(data, ('podcast', 'podcast', {
                'series_id': ('id', {str}),
                'series': ('title', {str}),
                'channel': ('title', {str}),
                'uploader': ('author', {str}),
            })),
        }