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

Code before:

        formats, subtitles = [], {}
        for stream in streams:
            if stream.get('media_type') == 'hls':
                fmts, subs = self._extract_m3u8_formats_and_subtitles(stream['url'], content_id, fatal=False)
                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            elif determine_ext(stream['url']) == 'pls':
                playlist_content = self._download_webpage(stream['url'], content_id)
                formats.append({
                    'url': self._search_regex(r'File1=(.*)', playlist_content, 'url', fatal=False),
                    'abr': stream.get('bitrate'),
                    'ext': stream.get('media_type'),
                })
            else:
                formats.append({
                    'url': stream['url'],
                    'abr': stream.get('bitrate'),
                    'ext': stream.get('media_type'),
                })

        return formats, subtitles


class TuneInStationIE(TuneInBaseIE):
    _VALID_URL = TuneInBaseIE._VALID_URL_BASE + r'(?:/radio/[^?&]+-|/embed/player/)(?P<id>s\d+)'
    _EMBED_REGEX = [r'<iframe[^>]+src=["\'](?P<url>(?:https?://)?tunein\.com/embed/player/s\d+)']

    _TESTS = [{
        'url': 'https://tunein.com/radio/Jazz24-885-s34682/',
        'info_dict': {
            'id': 's34682',
            'title': 're:^Jazz24',
            'description': 'md5:d6d0b89063fd68d529fa7058ee98619b',
            'thumbnail': 're:^https?://[^?&]+/s34682',
            'location': 'Seattle-Tacoma, US',
            'ext': 'mp3',
            'live_status': 'is_live',
        },
        'params': {
            'skip_download': True,
        },
    }, {
        'url': 'https://tunein.com/embed/player/s6404/',
        'only_matching': True,
    }, {
        'url': 'https://tunein.com/radio/BBC-Radio-1-988-s24939/',
        'info_dict': {
            'id': 's24939',
            'title': 're:^BBC Radio 1',
            'description': 'md5:f3f75f7423398d87119043c26e7bfb84',

Review comment (suggestion):
```suggestion
    _VALID_URL = TuneInBaseIE._VALID_URL_BASE + r'(?:/radio/[^?#]+-|/embed/player/)(?P<id>s\d+)'
```

Code after:

        formats, subtitles = [], {}
        for stream in streams:
            if stream.get('media_type') == 'hls':
                fmts, subs = self._extract_m3u8_formats_and_subtitles(stream['url'], content_id, fatal=False)
                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            elif determine_ext(stream['url']) == 'pls':
                playlist_content = self._download_webpage(stream['url'], content_id)
                formats.append({
                    'url': self._search_regex(r'File1=(.*)', playlist_content, 'url', fatal=False),
                    'abr': stream.get('bitrate'),
                    'ext': stream.get('media_type'),
                })
            else:
                formats.append({
                    'url': stream['url'],
                    'abr': stream.get('bitrate'),
                    'ext': stream.get('media_type'),
                })

        return formats, subtitles


class TuneInStationIE(TuneInBaseIE):
    _VALID_URL = TuneInBaseIE._VALID_URL_BASE + r'(?:/radio/[^?#]+-|/embed/player/)(?P<id>s\d+)'
    _EMBED_REGEX = [r'<iframe[^>]+src=["\'](?P<url>(?:https?://)?tunein\.com/embed/player/s\d+)']

    _TESTS = [{
        'url': 'https://tunein.com/radio/Jazz24-885-s34682/',
        'info_dict': {
            'id': 's34682',
            'title': 're:^Jazz24',
            'description': 'md5:d6d0b89063fd68d529fa7058ee98619b',
            'thumbnail': 're:^https?://[^?&]+/s34682',
            'location': 'Seattle-Tacoma, US',
            'ext': 'mp3',
            'live_status': 'is_live',
        },
        'params': {
            'skip_download': True,
        },
    }, {
        'url': 'https://tunein.com/embed/player/s6404/',
        'only_matching': True,
    }, {
        'url': 'https://tunein.com/radio/BBC-Radio-1-988-s24939/',
        'info_dict': {
            'id': 's24939',
            'title': 're:^BBC Radio 1',
            'description': 'md5:f3f75f7423398d87119043c26e7bfb84',