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

Code before:
import re
from .common import InfoExtractor
from ..utils import (
    determine_ext,
    extract_attributes,
    int_or_none,
    traverse_obj,
    url_or_none,
)


class DLFBaseIE(InfoExtractor):
    _VALID_URL_BASE = r'https?://(?:www\.)?deutschlandfunk\.de/'
    _BUTTON_REGEX = r'(<button[^>]+alt="Anhören"[^>]+data-audio-diraid[^>]*>)'

    def _parse_button_attrs(self, button, audio_id=None):
        attrs = extract_attributes(button)
        audio_id = audio_id or attrs['data-audio-diraid']

        url = traverse_obj(
            attrs, 'data-audio-download-src', 'data-audio', 'data-audioreference',
            'data-audio-src', expected_type=url_or_none)

        ext = determine_ext(url)

        return {
            'id': audio_id,
            'extractor_key': DLFIE.ie_key(),
            'extractor': DLFIE.IE_NAME,
            **traverse_obj(attrs, {
                'title': (('data-audiotitle', 'data-audio-title', 'data-audio-download-tracking-title'), {str}),
                'duration': (('data-audioduration', 'data-audio-duration'), {int_or_none}),
                'thumbnail': ('data-audioimage', {url_or_none}),
                'uploader': 'data-audio-producer',
                'series': 'data-audio-series',
                'channel': 'data-audio-origin-site-name',
                'webpage_url': ('data-audio-download-tracking-path', {url_or_none}),
            }, get_all=False),
            'formats': (self._extract_m3u8_formats(url, audio_id, fatal=False)
                        if ext == 'm3u8' else [{'url': url, 'ext': ext, 'vcodec': 'none'}])
        }


class DLFIE(DLFBaseIE):
    _VALID_URL = DLFBaseIE._VALID_URL_BASE + r'[\w-]+-dlf-(?P<id>[\da-f]{8})-100\.html'

    IE_NAME = 'dlf'
    _TESTS = [
        # Audio as an HLS stream

Review comment (suggestion):
just minor formatting nitpick
```suggestion
            'data-audio-src', expected_type=url_or_none)
        ext = determine_ext(url)
```

Code after:
import re

from .common import InfoExtractor
from ..utils import (
    determine_ext,
    extract_attributes,
    int_or_none,
    traverse_obj,
    url_or_none,
)


class DLFBaseIE(InfoExtractor):
    _VALID_URL_BASE = r'https?://(?:www\.)?deutschlandfunk\.de/'
    _BUTTON_REGEX = r'(<button[^>]+alt="Anhören"[^>]+data-audio-diraid[^>]*>)'

    def _parse_button_attrs(self, button, audio_id=None):
        attrs = extract_attributes(button)
        audio_id = audio_id or attrs['data-audio-diraid']

        url = traverse_obj(
            attrs, 'data-audio-download-src', 'data-audio', 'data-audioreference',
            'data-audio-src', expected_type=url_or_none)
        ext = determine_ext(url)

        return {
            'id': audio_id,
            'extractor_key': DLFIE.ie_key(),
            'extractor': DLFIE.IE_NAME,
            **traverse_obj(attrs, {
                'title': (('data-audiotitle', 'data-audio-title', 'data-audio-download-tracking-title'), {str}),
                'duration': (('data-audioduration', 'data-audio-duration'), {int_or_none}),
                'thumbnail': ('data-audioimage', {url_or_none}),
                'uploader': 'data-audio-producer',
                'series': 'data-audio-series',
                'channel': 'data-audio-origin-site-name',
                'webpage_url': ('data-audio-download-tracking-path', {url_or_none}),
            }, get_all=False),
            'formats': (self._extract_m3u8_formats(url, audio_id, fatal=False)
                        if ext == 'm3u8' else [{'url': url, 'ext': ext, 'vcodec': 'none'}])
        }


class DLFIE(DLFBaseIE):
    IE_NAME = 'dlf'
    _VALID_URL = DLFBaseIE._VALID_URL_BASE + r'[\w-]+-dlf-(?P<id>[\da-f]{8})-100\.html'
    _TESTS = [
        # Audio as an HLS stream
        {