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

Code before:
            'https://opml.radiotime.com/Tune.ashx', content_id, query={
                'formats': 'mp3,aac,ogg,flash,hls',
                'id': content_id,
                'render': 'json',
            },
        )['body']

        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)
            else:
                formats.append(traverse_obj(stream, {
                    'abr': ('bitrate', {int_or_none}),
                    'ext': ('media_type', {str}),
                    'url': ('url', {self._proto_relative_url}, {url_or_none}),
                }))

        return formats, subtitles


class TuneInStationIE(TuneInBaseIE):
    IE_NAME = 'tunein:station'
    _VALID_URL = r'https?://tunein\.com/radio/[^/]+(?P<id>s\d+)'
    _TESTS = [{
        'url': 'https://tunein.com/radio/Jazz24-885-s34682/',
        'info_dict': {
            'id': 's34682',
            'ext': 'mp3',
            'title': str,
            'alt_title': 'World Class Jazz',
            'channel_follower_count': int,
            'description': 'md5:d6d0b89063fd68d529fa7058ee98619b',
            'location': 'Seattle-Tacoma, US',
            'live_status': 'is_live',
            'thumbnail': r're:https?://.+',
        },
        'params': {'skip_download': 'Livestream'},
    }, {
        'url': 'https://tunein.com/radio/BBC-Radio-1-988-s24939/',
        'info_dict': {
            'id': 's24939',
            'ext': 'm4a',
            'title': str,
            'alt_title': 'The biggest new pop and all-day vibes',
            'channel_follower_count': int,
            'description': 'md5:ee2c56794844610d045f8caf5ff34d0c',
            'location': 'London, UK',
            'live_status': 'is_live',

Review comment (suggestion):
```suggestion
    _VALID_URL = r'https?://tunein\.com/radio/[^/?#]+(?P<id>s\d+)'
```

Code after:
    def _extract_formats_and_subtitles(self, content_id):
        streams = self._download_json(
            'https://opml.radiotime.com/Tune.ashx', content_id, query={
                'formats': 'mp3,aac,ogg,flash,hls',
                'id': content_id,
                'render': 'json',
            })

        formats, subtitles = [], {}
        for stream in traverse_obj(streams, ('body', lambda _, v: url_or_none(v['url']))):
            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)
            else:
                formats.append(traverse_obj(stream, {
                    'abr': ('bitrate', {int_or_none}),
                    'ext': ('media_type', {str}),
                    'url': ('url', {self._proto_relative_url}),
                }))

        return formats, subtitles


class TuneInStationIE(TuneInBaseIE):
    IE_NAME = 'tunein:station'
    _VALID_URL = r'https?://tunein\.com/radio/[^/?#]+(?P<id>s\d+)'
    _TESTS = [{
        'url': 'https://tunein.com/radio/Jazz24-885-s34682/',
        'info_dict': {
            'id': 's34682',
            'ext': 'mp3',
            'title': str,
            'alt_title': 'World Class Jazz',
            'channel_follower_count': int,
            'description': 'md5:d6d0b89063fd68d529fa7058ee98619b',
            'location': r're:Seattle-Tacoma, (?:US|WA)',
            'live_status': 'is_live',
            'thumbnail': r're:https?://.+',
        },
        'params': {'skip_download': 'Livestream'},
    }, {
        'url': 'https://tunein.com/radio/BBC-Radio-1-988-s24939/',
        'info_dict': {
            'id': 's24939',
            'ext': 'm4a',
            'title': str,
            'alt_title': 'The biggest new pop and all-day vibes',
            'channel_follower_count': int,
            'description': 'md5:ee2c56794844610d045f8caf5ff34d0c',
            'location': 'London, UK',