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

Code before:
import functools

from .common import InfoExtractor
from ..utils import (
    OnDemandPagedList,
    extract_attributes,
    get_element_by_class,
    get_element_html_by_class,
    get_element_text_and_html_by_tag,
    get_elements_html_by_class,
    int_or_none,
    join_nonempty,
    try_call,
    unified_strdate,
)
from ..utils.traversal import traverse_obj


class RadioComercialIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?radiocomercial\.pt/podcasts/[^/]+/\D*(?P<season>\d+)/(?P<id>[\w-]+)'
    _TESTS = [
        {
            'url': 'https://radiocomercial.pt/podcasts/o-homem-que-mordeu-o-cao/t6/taylor-swift-entranhando-se-que-nem-uma-espada-no-ventre-dos-fas',
            'md5': '5f4fe8e485b29d2e8fd495605bc2c7e4',
            'info_dict': {
                'id': 'taylor-swift-entranhando-se-que-nem-uma-espada-no-ventre-dos-fas',
                'ext': 'mp3',
                'title': 'Taylor Swift entranhando-se que nem uma espada no ventre dos fãs.',
                'description': None,
                'release_date': '20231025',
                'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
                'season': 6
            }
        },
        {
            'url': 'https://radiocomercial.pt/podcasts/convenca-me-num-minuto/t3/convenca-me-num-minuto-que-os-lobisomens-existem',
            'md5': '47e96c273aef96a8eb160cd6cf46d782',
            'info_dict': {
                'id': 'convenca-me-num-minuto-que-os-lobisomens-existem',
                'ext': 'mp3',
                'title': 'Convença-me num minuto que os lobisomens existem',
                'description': None,
                'release_date': '20231026',
                'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
                'season': 3
            }

Review comment (refactor):
Oh sorry, I should have been clearer on this. I didn't mean that you should indent the tests one more, but just to add the missing trailing commas and combine some of the lines. Take a look at any of the recently added extractors to see how tests are usually formatted ([example](https://github.com/yt-dlp/yt-dlp/pull/7616/files)).

Code after:
import itertools

from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
    ExtractorError,
    extract_attributes,
    get_element_by_class,
    get_element_html_by_class,
    get_element_text_and_html_by_tag,
    get_elements_html_by_class,
    int_or_none,
    join_nonempty,
    try_call,
    unified_strdate,
    update_url,
    urljoin
)
from ..utils.traversal import traverse_obj


class RadioComercialIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?radiocomercial\.pt/podcasts/[^/?#]+/t?(?P<season>\d+)/(?P<id>[\w-]+)'
    _TESTS = [{
        'url': 'https://radiocomercial.pt/podcasts/o-homem-que-mordeu-o-cao/t6/taylor-swift-entranhando-se-que-nem-uma-espada-no-ventre-dos-fas#page-content-wrapper',
        'md5': '5f4fe8e485b29d2e8fd495605bc2c7e4',
        'info_dict': {
            'id': 'taylor-swift-entranhando-se-que-nem-uma-espada-no-ventre-dos-fas',
            'ext': 'mp3',
            'title': 'Taylor Swift entranhando-se que nem uma espada no ventre dos fãs.',
            'release_date': '20231025',
            'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
            'season': 6
        }
    }, {
        'url': 'https://radiocomercial.pt/podcasts/convenca-me-num-minuto/t3/convenca-me-num-minuto-que-os-lobisomens-existem',
        'md5': '47e96c273aef96a8eb160cd6cf46d782',
        'info_dict': {
            'id': 'convenca-me-num-minuto-que-os-lobisomens-existem',
            'ext': 'mp3',
            'title': 'Convença-me num minuto que os lobisomens existem',
            'release_date': '20231026',
            'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
            'season': 3
        }
    }, {