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

Code before:
                    continue
                item_mode = 'sammlung' if item.get('type') == 'compilation' else 'video'
                yield self.url_result(
                    f'https://www.ardmediathek.de/{item_mode}/{item_id}',
                    ie=(ARDMediathekCollectionIE if item_mode == 'sammlung' else ARDBetaMediathekIE),
                    **traverse_obj(item, {
                        'id': ('id', {str}),
                        'title': ('longTitle', {str}),
                        'duration': ('duration', {int_or_none}),
                        'timestamp': ('broadcastedOn', {parse_iso8601}),
                    }))

        page_data = call_api(0)
        full_id = join_nonempty(playlist_id, season_number, version, delim='_')

        return self.playlist_result(
            OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
            title=page_data.get('title'), description=page_data.get('synopsis'))


class ARDAudiothekIE(InfoExtractor):
    _VALID_URL = r'''(?x)https:?//
        (?:www\.)?ardaudiothek\.de/
        (?:episode|(?P<playlist>sendung))/
        (?:(?(playlist)[a-zA-Z-]+)/)?
        (?P<id>urn:ard:(episode|section|extra|show):[a-f0-9]{16})/$'''

    _TESTS = [
        {
            'url': 'https://www.ardaudiothek.de/episode/urn:ard:episode:eabead1add170e93/',
            'info_dict': {
                'id': 'urn:ard:episode:eabead1add170e93',
                'ext': 'mp3',
                'upload_date': '20240717',
                'duration': 3339,
                'title': 'CAIMAN CLUB (S04E04): Cash Out',
                'thumbnail': 'https://api.ardmediathek.de/image-service/images/urn:ard:image:ed64411a07a4b405',
                'description': 'md5:0e5d127a3832ae59e8bab40a91a5dadc',
                'display_id': 'urn:ard:episode:eabead1add170e93',
                'timestamp': 1721181641,
                'series': '1LIVE Caiman Club',
                'channel': 'WDR',
                'episode': 'Episode 4',
                'episode_number': 4,
            },
        },
        {
            'url': 'https://www.ardaudiothek.de/sendung/mia-insomnia/urn:ard:show:c405aa26d9a4060a/',
            'info_dict': {
                'display_id': 'urn:ard:show:c405aa26d9a4060a',
                'title': 'Mia Insomnia',

Review comment (suggestion):
I think this matchgroup is not relevant and can be ignored?  
```suggestion
        (?P<id>urn:ard:(?:episode|section|extra|show):[a-f0-9]{16})/$'''
```

Code after:
                if not item_id or item_id == playlist_id:
                    continue
                item_mode = 'sammlung' if item.get('type') == 'compilation' else 'video'
                yield self.url_result(
                    f'https://www.ardmediathek.de/{item_mode}/{item_id}',
                    ie=(ARDMediathekCollectionIE if item_mode == 'sammlung' else ARDBetaMediathekIE),
                    **traverse_obj(item, {
                        'id': ('id', {str}),
                        'title': ('longTitle', {str}),
                        'duration': ('duration', {int_or_none}),
                        'timestamp': ('broadcastedOn', {parse_iso8601}),
                    }))

        page_data = call_api(0)
        full_id = join_nonempty(playlist_id, season_number, version, delim='_')

        return self.playlist_result(
            OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
            title=page_data.get('title'), description=page_data.get('synopsis'))


class ARDAudiothekBaseIE(InfoExtractor):
    def _graphql_query(self, urn, query):
        return self._download_json(
            'https://api.ardaudiothek.de/graphql', urn,
            data=json.dumps({
                'query': query,
                'variables': {'id': urn},
            }).encode(), headers={
                'Content-Type': 'application/json',
            })['data']


class ARDAudiothekIE(ARDAudiothekBaseIE):
    _VALID_URL = r'https:?//(?:www\.)?ardaudiothek\.de/episode/(?P<id>urn:ard:(?:episode|section|extra):[a-f0-9]{16})'

    _TESTS = [{
        'url': 'https://www.ardaudiothek.de/episode/urn:ard:episode:eabead1add170e93/',
        'info_dict': {
            'id': 'urn:ard:episode:eabead1add170e93',
            'ext': 'mp3',
            'upload_date': '20240717',
            'duration': 3339,
            'title': 'CAIMAN CLUB (S04E04): Cash Out',
            'thumbnail': 'https://api.ardmediathek.de/image-service/images/urn:ard:image:ed64411a07a4b405',
            'description': 'md5:0e5d127a3832ae59e8bab40a91a5dadc',
            'display_id': 'urn:ard:episode:eabead1add170e93',
            'timestamp': 1721181641,
            'series': '1LIVE Caiman Club',
            'channel': 'WDR',
            'episode': 'Episode 4',