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

Code before:
            'title': '21st Century Communities: Public Transportation Infrastructure Investment and FAST Act Reauthorization',
            'description': 'The Official website of The United States Committee on Banking, Housing, and Urban Affairs',
            'ext': 'mp4',
        },
        'params': {'skip_download': 'm3u8'},
    }]

    def _real_extract(self, url):
        display_id = self._generic_id(url)
        webpage = self._download_webpage(url, display_id)
        parse_info = parse_qs(self._search_regex(
            (r'<iframe class="[^>"]*streaminghearing[^>"]*"\s[^>]*\bsrc="([^">]*)',
             r'<iframe title="[^>"]*[^>"]*"\s[^>]*\bsrc="([^">]*)'),
            webpage, 'hearing URL'))
        comm = parse_info['comm'][-1]
        stream_num, stream_domain, stream_id, msl3 = _COMMITTEES[comm]
        filename = parse_info['filename'][-1]

        urls_alternatives = [f'https://www-senate-gov-media-srs.akamaized.net/hls/live/{stream_id}/{comm}/{filename}/master.m3u8',
                             f'https://www-senate-gov-msl3archive.akamaized.net/{msl3}/{filename}_1/master.m3u8',
                             f'{stream_domain}/i/{filename}_1@{stream_num}/master.m3u8',
                             f'{stream_domain}/i/{filename}.mp4/master.m3u8']
        for videourl in urls_alternatives:
            formats = self._extract_m3u8_formats(videourl, display_id, ext='mp4', fatal=False)
            if len(formats) > 0:
                break

        title = self._html_search_regex(
            (*self._og_regexes('title'), r'(?s)<title>([^<]*?)</title>'), webpage, 'video title')

        return {
            'id': re.sub(r'.mp4$', '', filename),
            'display_id': display_id,
            'title': re.sub(r'\s+', ' ', title.split('|')[0]).strip(),
            'description': self._og_search_description(webpage, default=None),
            'thumbnail': self._og_search_thumbnail(webpage, default=None),
            'age_limit': self._rta_search(webpage),
            'formats': formats
        }


Review comment (refactor):
```suggestion
        for video_url in urls_alternatives:
            formats = self._extract_m3u8_formats(video_url, display_id, ext='mp4', fatal=False)
            if formats:
                break
```

Code after:
            '_old_archive_ids': ['senategov appropsA051518'],
        },
        'params': {'skip_download': 'm3u8'},
        'expected_warnings': ['Failed to download m3u8 information'],
    }, {
        'url': 'https://www.banking.senate.gov/hearings/21st-century-communities-public-transportation-infrastructure-investment-and-fast-act-reauthorization',
        'info_dict': {
            'id': 'banking041521',
            'display_id': '21st-century-communities-public-transportation-infrastructure-investment-and-fast-act-reauthorization',
            'title': '21st Century Communities: Public Transportation Infrastructure Investment and FAST Act Reauthorization',
            'description': 'The Official website of The United States Committee on Banking, Housing, and Urban Affairs',
            'ext': 'mp4',
            'thumbnail': 'https://www.banking.senate.gov/themes/banking/images/sharelogo.jpg',
            'age_limit': 0,
            '_old_archive_ids': ['senategov banking041521'],
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://www.agriculture.senate.gov/hearings/hemp-production-and-the-2018-farm-bill',
        'only_matching': True,
    }, {
        'url': 'https://www.aging.senate.gov/hearings/the-older-americans-act-the-local-impact-of-the-law-and-the-upcoming-reauthorization',
        'only_matching': True,
    }, {
        'url': 'https://www.budget.senate.gov/hearings/improving-care-lowering-costs-achieving-health-care-efficiency',
        'only_matching': True,
    }, {
        'url': 'https://www.commerce.senate.gov/2024/12/communications-networks-safety-and-security',
        'only_matching': True,
    }, {
        'url': 'https://www.energy.senate.gov/hearings/2024/2/full-committee-hearing-to-examine',
        'only_matching': True,
    }, {
        'url': 'https://www.epw.senate.gov/public/index.cfm/hearings?ID=F63083EA-2C13-498C-B548-341BED68C209',
        'only_matching': True,
    }, {
        'url': 'https://www.foreign.senate.gov/hearings/american-diplomacy-and-global-leadership-review-of-the-fy25-state-department-budget-request',
        'only_matching': True,
    }, {
        'url': 'https://www.intelligence.senate.gov/hearings/foreign-threats-elections-2024-%E2%80%93-roles-and-responsibilities-us-tech-providers',
        'only_matching': True,
    }, {
        'url': 'https://www.inaugural.senate.gov/52nd-inaugural-ceremonies/',
        'only_matching': True,
    }, {
        'url': 'https://www.rules.senate.gov/hearings/02/07/2023/business-meeting',
        'only_matching': True,
    }, {
        'url': 'https://www.sbc.senate.gov/public/index.cfm/hearings?ID=5B13AA6B-8279-45AF-B54B-94156DC7A2AB',
        'only_matching': True,
    }, {