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

Code before:
        },
    }, {
        'url': 'https://media.ccc.de/v/32c3-7368-shopshifting#download',
        'only_matching': True,
    }, {
        'url': 'https://media.ccc.de/v/39c3-schlechte-karten-it-sicherheit-im-jahr-null-der-epa-fur-alle',
        'info_dict': {
            'id': '16261',
            'ext': 'mp4',
            'title': 'Schlechte Karten - IT-Sicherheit im Jahr null der ePA für alle',
            'display_id': '39c3-schlechte-karten-it-sicherheit-im-jahr-null-der-epa-fur-alle',
            'description': 'md5:719a5a9a52630249d606219c55056cbf',
            'view_count': int,
            'duration': 3619,
            'thumbnail': 'https://static.media.ccc.de/media/congress/2025/2403-2b5a6a8e-327e-594d-8f92-b91201d18a02.jpg',
            'tags': list,
            'creators': ['Bianca Kastl'],
            'timestamp': 1767024900,
            'upload_date': '20251229',
        },
    }]

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)
        event_id = self._search_regex(r"data-id=(?P<q>['\"])(?P<event_id>\d+)(?P=q)", webpage, 'event id', group='event_id')
        event_data = self._download_json(f'https://media.ccc.de/public/events/{event_id}', event_id)

        formats = []
        for recording in event_data.get('recordings', []):
            recording_url = recording.get('recording_url')
            if not recording_url:
                continue
            language = recording.get('language')
            folder = recording.get('folder')
            format_id = None
            if language:
                format_id = language
            if folder:
                if language:
                    format_id += '-' + folder
                else:
                    format_id = folder
            vcodec = 'h264' if 'h264' in folder else (
                'none' if folder in ('mp3', 'opus') else None
            )
            formats.append({
                'format_id': format_id,
                'url': recording_url,
                'width': int_or_none(recording.get('width')),
                'height': int_or_none(recording.get('height')),

Review comment (suggestion):
This can be simplified like this
```suggestion
        event_id = self._search_regex(r"data-id=(['\"])(?P<event_id>\d+)\1", webpage, 'event id', group='event_id')
```

Code after:
        },
    }, {
        'url': 'https://media.ccc.de/v/32c3-7368-shopshifting#download',
        'only_matching': True,
    }, {
        'url': 'https://media.ccc.de/v/39c3-schlechte-karten-it-sicherheit-im-jahr-null-der-epa-fur-alle',
        'info_dict': {
            'id': '16261',
            'ext': 'mp4',
            'title': 'Schlechte Karten - IT-Sicherheit im Jahr null der ePA für alle',
            'display_id': '39c3-schlechte-karten-it-sicherheit-im-jahr-null-der-epa-fur-alle',
            'description': 'md5:719a5a9a52630249d606219c55056cbf',
            'view_count': int,
            'duration': 3619,
            'thumbnail': 'https://static.media.ccc.de/media/congress/2025/2403-2b5a6a8e-327e-594d-8f92-b91201d18a02.jpg',
            'tags': list,
            'creators': ['Bianca Kastl'],
            'timestamp': 1767024900,
            'upload_date': '20251229',
        },
    }]

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)
        event_id = self._search_regex(r"data-id=(['\"])(?P<event_id>\d+)\1", webpage, 'event id', group='event_id')
        event_data = self._download_json(f'https://media.ccc.de/public/events/{event_id}', event_id)

        formats = []
        for recording in event_data.get('recordings', []):
            recording_url = recording.get('recording_url')
            if not recording_url:
                continue
            language = recording.get('language')
            folder = recording.get('folder')
            format_id = None
            if language:
                format_id = language
            if folder:
                if language:
                    format_id += '-' + folder
                else:
                    format_id = folder
            vcodec = 'h264' if 'h264' in folder else (
                'none' if folder in ('mp3', 'opus') else None
            )
            formats.append({
                'format_id': format_id,
                'url': recording_url,
                'width': int_or_none(recording.get('width')),
                'height': int_or_none(recording.get('height')),