ronantakizawa/codereview-bench huggingface dataset:
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/faulio.py (Python)

Code before:
import re

from .common import InfoExtractor
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj


class FaulioLiveIE(InfoExtractor):
    _VALID_URL = (
        r'https?://(?P<domain>aloula\.sba\.sa|maraya\.sba\.net\.ae|sat7plus\.org)/'
        r'(?:en/)?live/(?P<faulio_url>[a-zA-Z0-9\-]+)'
    )

    _TESTS = [{
        'url': 'https://aloula.sba.sa/live/saudiatv',
        'info_dict': {
            'id': '2',
            'title': str,
            'description': str,
            'ext': 'mp4',
            'live_status': 'is_live',
        },
        'params': {
            'skip_download': 'Livestream',
        },
    }, {
        'url': 'https://aloula.sba.sa/live/sbc-channel',
        'info_dict': {
            'id': '1',
            'title': str,
            'description': str,
            'ext': 'mp4',
            'live_status': 'is_live',
        },
        'params': {
            'skip_download': 'Livestream',
        },
    }, {

Review comment (suggestion):
```suggestion
    _VALID_URL = r'https?://(?:aloula\.sba\.sa|maraya\.sba\.net\.ae|sat7plus\.org)/(?:(?:en|ar|fa)/)?live/(?P<id>[a-zA-Z0-9\-]+)'
```

Code after:
import re
import urllib.parse

from .common import InfoExtractor
from ..utils import js_to_json, url_or_none
from ..utils.traversal import traverse_obj


class FaulioLiveIE(InfoExtractor):
    _DOMAINS = (
        'aloula.sba.sa',
        'maraya.sba.net.ae',
        'sat7plus.org',
    )
    _VALID_URL = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:en|ar|fa)/)?live/(?P<id>[a-zA-Z0-9-]+)'
    _TESTS = [{
        'url': 'https://aloula.sba.sa/live/saudiatv',
        'info_dict': {
            'id': 'aloula.faulio.com_saudiatv',
            'title': str,
            'description': str,
            'ext': 'mp4',
            'live_status': 'is_live',
        },
        'params': {
            'skip_download': 'Livestream',
        },
    }, {
        'url': 'https://maraya.sba.net.ae/live/1',
        'info_dict': {
            'id': 'maraya.faulio.com_1',
            'title': str,
            'description': str,
            'ext': 'mp4',
            'live_status': 'is_live',
        },
        'params': {
            'skip_download': 'Livestream',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/faulio.py (Python)

Code before:
import urllib.parse

from .common import InfoExtractor
from ..utils import js_to_json, url_or_none
from ..utils.traversal import traverse_obj


class FaulioLiveIE(InfoExtractor):
    _VALID_URL = r'https?://(?:aloula\.sba\.sa|maraya\.sba\.net\.ae|sat7plus\.org)/(?:(?:en|ar|fa)/)?live/(?P<id>[a-zA-Z0-9\-]+)'
    _TESTS = [{
        'url': 'https://aloula.sba.sa/live/saudiatv',
        'info_dict': {
            'id': 'aloula.faulio.com:saudiatv',
            'title': str,
            'description': str,
            'ext': 'mp4',
            'live_status': 'is_live',
        },
        'params': {
            'skip_download': 'Livestream',
        },
    }, {
        'url': 'https://maraya.sba.net.ae/live/1',
        'info_dict': {
            'id': 'maraya.faulio.com:1',
            'title': str,
            'description': str,
            'ext': 'mp4',
            'live_status': 'is_live',
        },
        'params': {
            'skip_download': 'Livestream',
        },
    }, {

Review comment (security):
```suggestion
    _DOMAINS = (
        'aloula.sba.sa',
        'maraya.sba.net.ae',
        'sat7plus.org',
    )
    _VALID_URL = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:en|ar|fa)/)?live/(?P<id>[a-zA-Z0-9-]+)'
```

Code after:
import re
import urllib.parse

from .common import InfoExtractor
from ..utils import js_to_json, url_or_none
from ..utils.traversal import traverse_obj


class FaulioLiveIE(InfoExtractor):
    _DOMAINS = (
        'aloula.sba.sa',
        'maraya.sba.net.ae',
        'sat7plus.org',
    )
    _VALID_URL = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:en|ar|fa)/)?live/(?P<id>[a-zA-Z0-9-]+)'
    _TESTS = [{
        'url': 'https://aloula.sba.sa/live/saudiatv',
        'info_dict': {
            'id': 'aloula.faulio.com_saudiatv',
            'title': str,
            'description': str,
            'ext': 'mp4',
            'live_status': 'is_live',
        },
        'params': {
            'skip_download': 'Livestream',
        },
    }, {
        'url': 'https://maraya.sba.net.ae/live/1',
        'info_dict': {
            'id': 'maraya.faulio.com_1',
            'title': str,
            'description': str,
            'ext': 'mp4',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/faulio.py (Python)

Code before:

        config_data = self._search_json(
            r'window\.__NUXT__\.config=', webpage, 'config', video_id, transform_source=js_to_json)
        api_base = config_data['public']['TRANSLATIONS_API_URL']

        channel = traverse_obj(
            self._download_json(f'{api_base}/channels', video_id),
            (lambda k, v: v['url'] == video_id, any))

        formats = []
        subtitles = {}
        if hls_url := traverse_obj(channel, ('streams', 'hls', {url_or_none})):
            fmts, subs = self._extract_m3u8_formats_and_subtitles(
                hls_url, video_id, 'mp4', m3u8_id='hls', live=True, fatal=False)
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)

        if mpd_url := traverse_obj(channel, ('streams', 'mpd', {url_or_none})):
            fmts, subs = self._extract_mpd_formats_and_subtitles(
                mpd_url, video_id, mpd_id='dash', fatal=False)
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)

        domain = urllib.parse.urlparse(api_base).hostname
        return {
            'id': f'{domain}:{video_id}',
            **traverse_obj(channel, {
                'title': ('title', {str}),
                'description': ('description', {str}),
            }),
            'formats': formats,
            'subtitles': subtitles,
            'is_live': True,
        }


Review comment (suggestion):
```suggestion
        return {
            'id': f'{urllib.parse.urlparse(api_base).hostname}:{video_id}',
```

Code after:
        'only_matching': True,
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)

        config_data = self._search_json(
            r'window\.__NUXT__\.config=', webpage, 'config', video_id, transform_source=js_to_json)
        api_base = config_data['public']['TRANSLATIONS_API_URL']

        channel = traverse_obj(
            self._download_json(f'{api_base}/channels', video_id),
            (lambda k, v: v['url'] == video_id, any))

        formats = []
        subtitles = {}
        if hls_url := traverse_obj(channel, ('streams', 'hls', {url_or_none})):
            fmts, subs = self._extract_m3u8_formats_and_subtitles(
                hls_url, video_id, 'mp4', m3u8_id='hls', live=True, fatal=False)
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)

        if mpd_url := traverse_obj(channel, ('streams', 'mpd', {url_or_none})):
            fmts, subs = self._extract_mpd_formats_and_subtitles(
                mpd_url, video_id, mpd_id='dash', fatal=False)
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)

        return {
            'id': f'{urllib.parse.urlparse(api_base).hostname}_{video_id}',
            **traverse_obj(channel, {
                'title': ('title', {str}),
                'description': ('description', {str}),
            }),
            'formats': formats,
            'subtitles': subtitles,
            'is_live': True,
        }
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/filmarchiv.py (Python)

Code before:
from .common import InfoExtractor


class FilmArchivIE(InfoExtractor):
    IE_NAME = 'FILMARCHIV ON'
    _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/(?:de|en)/filmarchiv-on/video/(?P<id>[0-9a-zA-Z_]+)'
    _TESTS = [{
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0305p7xKrXUPBwoNE9x6mh',
        'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
        'info_dict': {
            'id': 'f_0305p7xKrXUPBwoNE9x6mh',
            'ext': 'mkv',
            'title': 'Der Wurstelprater zur Kaiserzeit',
            'description': 'md5:9843f92df5cc9a4975cee7aabcf6e3b2',
            'thumbnail': 'https://img.filmarchiv.at/unsafe/1024x1024/videostatic/f_0305/p7xKrXUPBwoNE9x6mh_v1/poster.jpg',
        },
    }]

    def _real_extract(self, url):
        media_id = self._match_id(url)
        webpage = self._download_webpage(url, media_id)

        title = self._html_search_regex(
            r'<title-div [^>]+>\s*(.+?)\s*</title-div>',
            webpage, 'title')


Review comment (refactor):
```suggestion
from .common import InfoExtractor
from ..utils import clean_html
from ..utils.traversal import find_elements, traverse_obj
```

Code after:
from .common import InfoExtractor
from ..utils import clean_html
from ..utils.traversal import (
    find_element,
    find_elements,
    traverse_obj,
)


class FilmArchivIE(InfoExtractor):
    IE_DESC = 'FILMARCHIV ON'
    _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/de/filmarchiv-on/video/(?P<id>f_[0-9a-zA-Z]{5,})'
    _TESTS = [{
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0305p7xKrXUPBwoNE9x6mh',
        'md5': '54a6596f6a84624531866008a77fa27a',
        'info_dict': {
            'id': 'f_0305p7xKrXUPBwoNE9x6mh',
            'ext': 'mp4',
            'title': 'Der Wurstelprater zur Kaiserzeit',
            'description': 'md5:9843f92df5cc9a4975cee7aabcf6e3b2',
            'thumbnail': r're:https://cdn\.filmarchiv\.at/f_0305/p7xKrXUPBwoNE9x6mh_v1/poster\.jpg',
        },
    }, {
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0306vI3wO0tJIsfrqYFQXF',
        'md5': '595385d7f54cb6529140ee8de7d1c3c7',
        'info_dict': {
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/filmarchiv.py (Python)

Code before:
from .common import InfoExtractor
from ..utils import clean_html
from ..utils.traversal import find_elements, traverse_obj


class FilmArchivIE(InfoExtractor):
    IE_NAME = 'FILMARCHIV ON'
    _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/(?:de|en)/filmarchiv-on/video/(?P<id>[0-9a-zA-Z_]+)'
    _TESTS = [{
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0305p7xKrXUPBwoNE9x6mh',
        'md5': '54a6596f6a84624531866008a77fa27a',
        'info_dict': {
            'id': 'f_0305p7xKrXUPBwoNE9x6mh',
            'ext': 'mp4',
            'title': 'Der Wurstelprater zur Kaiserzeit',
            'description': 'md5:9843f92df5cc9a4975cee7aabcf6e3b2',
            'thumbnail': r're:https://cdn.filmarchiv.at/f_0305/p7xKrXUPBwoNE9x6mh[^/]*/poster.jpg$',
        },
    }]

    def _real_extract(self, url):
        media_id = self._match_id(url)
        webpage = self._download_webpage(url, media_id)

        title = self._html_search_regex(
            r'<title-div[^>]*>\s*(.+?)\s*</title-div>',
            webpage, 'title')

        description = traverse_obj(webpage, (
            {find_elements(
                tag='div',
                attr='class', value=r'[^\'"]*(?<=[\'"\s])border-base-content(?=[\'"\s])[^\'"]*',
                html=False, regex=True)}, ...,

Review comment (suggestion):
```suggestion
    _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/(?:de|en)/filmarchiv-on/video/(?P<id>[0-9a-zA-Z_]+)'
```
can you provide a test url for `en` as well

Code after:
from .common import InfoExtractor
from ..utils import clean_html
from ..utils.traversal import (
    find_element,
    find_elements,
    traverse_obj,
)


class FilmArchivIE(InfoExtractor):
    IE_DESC = 'FILMARCHIV ON'
    _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/de/filmarchiv-on/video/(?P<id>f_[0-9a-zA-Z]{5,})'
    _TESTS = [{
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0305p7xKrXUPBwoNE9x6mh',
        'md5': '54a6596f6a84624531866008a77fa27a',
        'info_dict': {
            'id': 'f_0305p7xKrXUPBwoNE9x6mh',
            'ext': 'mp4',
            'title': 'Der Wurstelprater zur Kaiserzeit',
            'description': 'md5:9843f92df5cc9a4975cee7aabcf6e3b2',
            'thumbnail': r're:https://cdn\.filmarchiv\.at/f_0305/p7xKrXUPBwoNE9x6mh_v1/poster\.jpg',
        },
    }, {
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0306vI3wO0tJIsfrqYFQXF',
        'md5': '595385d7f54cb6529140ee8de7d1c3c7',
        'info_dict': {
            'id': 'f_0306vI3wO0tJIsfrqYFQXF',
            'ext': 'mp4',
            'title': 'Vor 70 Jahren: Wettgehen der Briefträger in Wien',
            'description': 'md5:b2a2e4230923cd1969d471c552e62811',
            'thumbnail': r're:https://cdn\.filmarchiv\.at/f_0306/vI3wO0tJIsfrqYFQXF_v1/poster\.jpg',
        },
    }]
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/filmarchiv.py (Python)

Code before:
from .common import InfoExtractor
from ..utils import clean_html
from ..utils.traversal import find_elements, traverse_obj


class FilmArchivIE(InfoExtractor):
    IE_NAME = 'FILMARCHIV ON'
    _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/de/filmarchiv-on/video/(?P<id>[0-9a-zA-Z_]+)'
    _TESTS = [{
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0305p7xKrXUPBwoNE9x6mh',
        'md5': '54a6596f6a84624531866008a77fa27a',
        'info_dict': {
            'id': 'f_0305p7xKrXUPBwoNE9x6mh',
            'ext': 'mp4',
            'title': 'Der Wurstelprater zur Kaiserzeit',
            'description': 'md5:9843f92df5cc9a4975cee7aabcf6e3b2',
            'thumbnail': r're:https://cdn.filmarchiv.at/f_0305/p7xKrXUPBwoNE9x6mh[^/]*/poster.jpg$',
        },
    }]

    def _real_extract(self, url):
        media_id = self._match_id(url)
        webpage = self._download_webpage(url, media_id)

        title = traverse_obj(webpage, ({find_elements(tag='title-div')}, {clean_html}))

        description = traverse_obj(webpage, (
            {find_elements(

Review comment (suggestion):
```suggestion
from ..utils.traversal import (
    find_element,
    find_elements,
    traverse_obj,
)
```

Code after:
from .common import InfoExtractor
from ..utils import clean_html
from ..utils.traversal import (
    find_element,
    find_elements,
    traverse_obj,
)


class FilmArchivIE(InfoExtractor):
    IE_DESC = 'FILMARCHIV ON'
    _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/de/filmarchiv-on/video/(?P<id>f_[0-9a-zA-Z]{5,})'
    _TESTS = [{
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0305p7xKrXUPBwoNE9x6mh',
        'md5': '54a6596f6a84624531866008a77fa27a',
        'info_dict': {
            'id': 'f_0305p7xKrXUPBwoNE9x6mh',
            'ext': 'mp4',
            'title': 'Der Wurstelprater zur Kaiserzeit',
            'description': 'md5:9843f92df5cc9a4975cee7aabcf6e3b2',
            'thumbnail': r're:https://cdn\.filmarchiv\.at/f_0305/p7xKrXUPBwoNE9x6mh_v1/poster\.jpg',
        },
    }, {
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0306vI3wO0tJIsfrqYFQXF',
        'md5': '595385d7f54cb6529140ee8de7d1c3c7',
        'info_dict': {
            'id': 'f_0306vI3wO0tJIsfrqYFQXF',
            'ext': 'mp4',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/filmarchiv.py (Python)

Code before:
        webpage = self._download_webpage(url, media_id)

        title = traverse_obj(webpage, ({find_elements(tag='title-div')}, {clean_html}))

        description = traverse_obj(webpage, (
            {find_elements(
                tag='div',
                attr='class', value=r'[^\'"]*(?<=[\'"\s])border-base-content(?=[\'"\s])[^\'"]*',
                html=False, regex=True)}, ...,
            {find_elements(
                tag='div',
                attr='class', value=r'[^\'"]*(?<=[\'"\s])prose(?=[\'"\s])[^\'"]*',
                html=False, regex=True)}, ...,
            {clean_html}, any,
        ))

        og_img = self._html_search_meta('og:image', webpage, 'image URL', fatal=True)
        prefix = self._search_regex(
            r'/videostatic/([^/]+/[^_]+_[^/]+)/poster.jpg', og_img, 'prefix')

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(
            f'https://cdn.filmarchiv.at/{prefix}_sv1/playlist.m3u8', media_id)

        return {
            'id': media_id,
            'title': title,
            'description': description,
            'thumbnail': f'https://cdn.filmarchiv.at/{prefix}/poster.jpg',
            'formats': formats,
            'subtitles': subtitles,
        }


Review comment (suggestion):
```suggestion
            'title': traverse_obj(webpage, ({find_element(tag='title-div')}, {clean_html})),
```

Code after:
    }, {
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0306vI3wO0tJIsfrqYFQXF',
        'md5': '595385d7f54cb6529140ee8de7d1c3c7',
        'info_dict': {
            'id': 'f_0306vI3wO0tJIsfrqYFQXF',
            'ext': 'mp4',
            'title': 'Vor 70 Jahren: Wettgehen der Briefträger in Wien',
            'description': 'md5:b2a2e4230923cd1969d471c552e62811',
            'thumbnail': r're:https://cdn\.filmarchiv\.at/f_0306/vI3wO0tJIsfrqYFQXF_v1/poster\.jpg',
        },
    }]

    def _real_extract(self, url):
        media_id = self._match_id(url)
        webpage = self._download_webpage(url, media_id)
        path = '/'.join((media_id[:6], media_id[6:]))
        formats, subtitles = self._extract_m3u8_formats_and_subtitles(
            f'https://cdn.filmarchiv.at/{path}_v1_sv1/playlist.m3u8', media_id)

        return {
            'id': media_id,
            'title': traverse_obj(webpage, ({find_element(tag='title-div')}, {clean_html})),
            'description': traverse_obj(webpage, (
                {find_elements(tag='div', attr='class', value=r'.*\bborder-base-content\b', regex=True)}, ...,
                {find_elements(tag='div', attr='class', value=r'.*\bprose\b', html=False, regex=True)}, ...,
                {clean_html}, any)),
            'thumbnail': f'https://cdn.filmarchiv.at/{path}_v1/poster.jpg',
            'formats': formats,
            'subtitles': subtitles,
        }
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/filmarchiv.py (Python)

Code before:
from .common import InfoExtractor
from ..utils import clean_html
from ..utils.traversal import (
    find_element,
    find_elements,
    traverse_obj,
)


class FilmArchivIE(InfoExtractor):
    IE_NAME = 'FILMARCHIV ON'
    _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/de/filmarchiv-on/video/(?P<id>[0-9a-zA-Z_]+)'
    _TESTS = [{
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0305p7xKrXUPBwoNE9x6mh',
        'md5': '54a6596f6a84624531866008a77fa27a',
        'info_dict': {
            'id': 'f_0305p7xKrXUPBwoNE9x6mh',
            'ext': 'mp4',
            'title': 'Der Wurstelprater zur Kaiserzeit',
            'description': 'md5:9843f92df5cc9a4975cee7aabcf6e3b2',
            'thumbnail': r're:https://cdn.filmarchiv.at/f_0305/p7xKrXUPBwoNE9x6mh[^/]*/poster.jpg$',
        },
    }, {
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0306vI3wO0tJIsfrqYFQXF',
        'md5': '595385d7f54cb6529140ee8de7d1c3c7',
        'info_dict': {
            'id': 'f_0306vI3wO0tJIsfrqYFQXF',
            'ext': 'mp4',
            'title': 'Vor 70 Jahren: Wettgehen der Briefträger in Wien',
            'description': 'md5:b2a2e4230923cd1969d471c552e62811',
            'thumbnail': r're:https://cdn.filmarchiv.at/f_0306/vI3wO0tJIsfrqYFQXF[^/]*/poster.jpg$',
        },
    }]

    def _real_extract(self, url):
        media_id = self._match_id(url)
        webpage = self._download_webpage(url, media_id)

Review comment (suggestion):
```suggestion
    _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/de/filmarchiv-on/video/(?P<id>f_[0-9a-zA-Z]{5,})'
```

Code after:
from .common import InfoExtractor
from ..utils import clean_html
from ..utils.traversal import (
    find_element,
    find_elements,
    traverse_obj,
)


class FilmArchivIE(InfoExtractor):
    IE_DESC = 'FILMARCHIV ON'
    _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/de/filmarchiv-on/video/(?P<id>f_[0-9a-zA-Z]{5,})'
    _TESTS = [{
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0305p7xKrXUPBwoNE9x6mh',
        'md5': '54a6596f6a84624531866008a77fa27a',
        'info_dict': {
            'id': 'f_0305p7xKrXUPBwoNE9x6mh',
            'ext': 'mp4',
            'title': 'Der Wurstelprater zur Kaiserzeit',
            'description': 'md5:9843f92df5cc9a4975cee7aabcf6e3b2',
            'thumbnail': r're:https://cdn\.filmarchiv\.at/f_0305/p7xKrXUPBwoNE9x6mh_v1/poster\.jpg',
        },
    }, {
        'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0306vI3wO0tJIsfrqYFQXF',
        'md5': '595385d7f54cb6529140ee8de7d1c3c7',
        'info_dict': {
            'id': 'f_0306vI3wO0tJIsfrqYFQXF',
            'ext': 'mp4',
            'title': 'Vor 70 Jahren: Wettgehen der Briefträger in Wien',
            'description': 'md5:b2a2e4230923cd1969d471c552e62811',
            'thumbnail': r're:https://cdn\.filmarchiv\.at/f_0306/vI3wO0tJIsfrqYFQXF_v1/poster\.jpg',
        },
    }]

    def _real_extract(self, url):
        media_id = self._match_id(url)
        webpage = self._download_webpage(url, media_id)
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/thehighwire.py (Python)

Code before:
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)

        iframe_url = self._search_regex(
            r'<iframe[^>]+src=["\'](https?://app\.arkengine\.com/embed/[^"\']+)',
            webpage, 'iframe URL')
        video_id = self._search_regex(
            r'embed/([a-zA-Z0-9]+)', iframe_url, 'video ID')

        player_page = self._download_webpage(
            self._EMBED_URL.format(id=video_id), video_id,
            note='Downloading player page')

        m3u8_url = self._search_regex(
            r'<source[^>]+src=["\']([^"\']+\.m3u8)',
            player_page, 'm3u8 URL')

        title = self._og_search_title(webpage, default=None) or self._html_search_meta(
            'og:title', webpage, 'title', default=video_id)

        return {
            'id': video_id,
            'display_id': display_id,
            'title': title,
            'formats': self._extract_m3u8_formats(m3u8_url, video_id, 'mp4'),
        }


Review comment (suggestion):
`_parse_html5_media_entries` takes on most processing
```suggestion
        return {
            'id': display_id,
            **traverse_obj(webpage, {
                'title': ({find_element(cls='section-header')}, {clean_html}),
                'description': ({find_element(cls='episode-description__copy')}, {clean_html}),
            }),
            **self._parse_html5_media_entries(embed_url, embed_page, display_id, m3u8_id='hls')[0],
        }

```

Code after:
        'url': 'https://thehighwire.com/ark-videos/the-deposition-of-stanley-plotkin/',
        'info_dict': {
            'id': 'the-deposition-of-stanley-plotkin',
            'ext': 'mp4',
            'title': 'THE DEPOSITION OF STANLEY PLOTKIN',
            'description': 'md5:6d0be4f1181daaa10430fd8b945a5e54',
            'thumbnail': r're:https?://static\.arkengine\.com/video/.+\.jpg',
        },
    }]

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)

        embed_url = traverse_obj(webpage, (
            {find_element(cls='ark-video-embed', html=True)},
            {extract_attributes}, 'src', {url_or_none}, {require('embed URL')}))
        embed_page = self._download_webpage(embed_url, display_id)

        return {
            'id': display_id,
            **traverse_obj(webpage, {
                'title': ({find_element(cls='section-header')}, {clean_html}),
                'description': ({find_element(cls='episode-description__copy')}, {clean_html}),
            }),
            **self._parse_html5_media_entries(embed_url, embed_page, display_id, m3u8_id='hls')[0],
        }