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

Code before:
        'url': 'https://www.appropriations.senate.gov/hearings/watch?hearingid=B8A25434-5056-A066-6020-1F68CB75F0CD',
        'info_dict': {
            'id': 'appropsA051518',
            'display_id': 'watch?hearingid=B8A25434-5056-A066-6020-1F68CB75F0CD',
            'title': 'Review of the FY2019 Budget Request for the U.S. Army',
            'ext': 'mp4',
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        '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',
        },
        'params': {'skip_download': 'm3u8'},
    }]

    def _real_extract(self, url):
        display_id = self._generic_id(url)
        webpage = self._download_webpage(url, display_id)
        iframe_src = self._search_regex(
            (r'<iframe class="[^>"]*streaminghearing[^>"]*"\s[^>]*\bsrc="([^">]*)',
             r'<iframe title="[^>"]*[^>"]*"\s[^>]*\bsrc="([^">]*)'),
            webpage, 'hearing URL').replace('&amp;', '&')
        parse_info = parse_qs(iframe_src)
        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 video_url in urls_alternatives:
            formats = self._extract_m3u8_formats(video_url, display_id, ext='mp4', fatal=False)
            if formats:
                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),

Review comment (suggestion):
```suggestion
            (r'<iframe class="[^>"]*streaminghearing[^>"]*"\s[^>]*\bsrc="([^>"]+)',
             r'<iframe title="[^>"]*"\s[^>]*\bsrc="([^">]+)'),
```

Code after:
            'description': 'The U.S. Senate Committee on Health, Education, Labor & Pensions',
            'ext': 'mp4',
            'age_limit': 0,
            'thumbnail': 'https://www.help.senate.gov/assets/images/sharelogo.jpg',
            '_old_archive_ids': ['senategov help090920'],
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://www.appropriations.senate.gov/hearings/watch?hearingid=B8A25434-5056-A066-6020-1F68CB75F0CD',
        'info_dict': {
            'id': 'appropsA051518',
            'display_id': 'watch?hearingid=B8A25434-5056-A066-6020-1F68CB75F0CD',
            'title': 'Review of the FY2019 Budget Request for the U.S. Army',
            'ext': 'mp4',
            'age_limit': 0,
            'thumbnail': 'https://www.appropriations.senate.gov/themes/appropriations/images/video-poster-flash-fit.png',
            '_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,