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

Code before:
            'info_dict': {
                'id': 'NTSRadio_absolute-fiction-23rd-july-2022',
                'ext': 'webm',
                'like_count': int,
                'title': 'Absolute Fiction - 23rd July 2022',
                'comment_count': int,
                'uploader_url': 'https://www.mixcloud.com/NTSRadio/',
                'description': 'md5:a8cb9d9f040adb6525d33a6604fc759c',
                'tags': [],
                'duration': 3529,
                'timestamp': 1658772398,
                'repost_count': int,
                'upload_date': '20220725',
                'uploader_id': 'NTSRadio',
                'thumbnail': 'https://thumbnailer.mixcloud.com/unsafe/1024x1024/extaudio/5/1/a/d/ae3e-1be9-4fd4-983e-9c3294226eac',
                'uploader': 'Mixcloud NTS Radio',
            }
        }
    ]

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

        attrs = extract_attributes(self._search_regex(
            r'(<button[^>]+?aria-label="Play"[^>]*?>)', webpage, 'player'))

        return self.url_result(attrs['data-src'])


Review comment (refactor):
I would instead parse the react state:
```suggestion
        data = self._search_json(r'window\._REACT_STATE_\s*=', webpage, 'react state', video_id)
```
Hopefully, that is more reliable than extracting from the HTML

Code after:
        {
            # embedded mixcloud
            'url': 'https://www.nts.live/shows/absolute-fiction/episodes/absolute-fiction-23rd-july-2022',
            'info_dict': {
                'id': 'NTSRadio_absolute-fiction-23rd-july-2022',
                'ext': 'webm',
                'like_count': int,
                'title': 'Absolute Fiction',
                'comment_count': int,
                'uploader_url': 'https://www.mixcloud.com/NTSRadio/',
                'description': 'md5:ba49da971ae8d71ee45813c52c5e2a04',
                'tags': [],
                'duration': 3529,
                'timestamp': 1658588400,
                'repost_count': int,
                'upload_date': '20220723',
                'uploader_id': 'NTSRadio',
                'thumbnail': 'https://thumbnailer.mixcloud.com/unsafe/1024x1024/extaudio/5/1/a/d/ae3e-1be9-4fd4-983e-9c3294226eac',
                'uploader': 'Mixcloud NTS Radio',
                'genres': ['Minimal Synth', 'Post Punk', 'Industrial '],
                'modified_timestamp': 1658842165,
                'modified_date': '20220726',
            },
            'params': {'skip_download': 'm3u8'},
        },
    ]

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

        data = self._search_json(r'window\._REACT_STATE_\s*=', webpage, 'react state', video_id)

        return {
            '_type': 'url_transparent',
            **traverse_obj(data, ('episode', {
                'url': ('audio_sources', ..., 'url', {url_or_none}, any),
                'title': ('name', {str}),
                'description': ('description', {str}),
                'genres': ('genres', ..., 'value', {str}),
                'timestamp': ('broadcast', {parse_iso8601}),
                'modified_timestamp': ('updated', {parse_iso8601}),
            })),
        }