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

Code before:

    def _entries(self, show, season, load_more_url):
        skip_ids = []
        has_more = True

        base_url = f'https://10play.com.au/{show}/episodes/{season}'

        while has_more:
            episodes_carousel = self._download_json(
                load_more_url, f'{show}/{season}', query={'skipIds[]': skip_ids},
                note=f'Fetching episodes {len(skip_ids)}+')

            has_more = episodes_carousel['hasMore']
            episodes_chunk = episodes_carousel['items']
            skip_ids += [ep['id'] for ep in episodes_chunk]

            yield from [urljoin(base_url, ep['cardLink']) for ep in episodes_chunk]

    def _real_extract(self, url):
        show, season = self._match_valid_url(url).group('show', 'season')

        season_info = self._download_json(
            f'https://10play.com.au/api/shows/{show}/episodes/{season}', f'{show}/{season}')

        episodes_carousel = traverse_obj(season_info, ('content', 0, 'components', (
            lambda _, v: v['title'].lower() == 'episodes', (..., {dict}))), get_all=False) or {}

        playlist_id = episodes_carousel['tpId']
        playlist_title = traverse_obj(season_info, ('content', 0, 'title', {str}))

        load_more_url = urljoin(url, episodes_carousel['loadMoreUrl'])

        return self.playlist_from_matches(
            self._entries(show, season, load_more_url), playlist_id, playlist_title)


Review comment (suggestion):
just formatting / readability
```suggestion
        episodes_carousel = traverse_obj(season_info, (
            'content', 0, 'components', (
                lambda _, v: v['title'].lower() == 'episodes',
                (..., {dict}),
            )), get_all=False) or {}
```

Code after:
                load_more_url, display_id, query={'skipIds[]': skip_ids},
                note=f'Fetching episodes page {page}')

            episodes_chunk = episodes_carousel['items']
            skip_ids.extend(ep['id'] for ep in episodes_chunk)

            for ep in episodes_chunk:
                yield ep['cardLink']
            if not episodes_carousel['hasMore']:
                break

    def _real_extract(self, url):
        show, season = self._match_valid_url(url).group('show', 'season')
        season_info = self._download_json(
            f'https://10play.com.au/api/shows/{show}/episodes/{season}', f'{show}/{season}')

        episodes_carousel = traverse_obj(season_info, (
            'content', 0, 'components', (
                lambda _, v: v['title'].lower() == 'episodes',
                (..., {dict}),
            )), get_all=False) or {}

        playlist_id = episodes_carousel['tpId']

        return self.playlist_from_matches(
            self._entries(urljoin(url, episodes_carousel['loadMoreUrl']), playlist_id),
            playlist_id, traverse_obj(season_info, ('content', 0, 'title', {str})),
            getter=functools.partial(urljoin, url))
Repository: yt-dlp/yt-dlp
File: yt_dlp/networking/_helper.py (Python)

Code before:
    if source_address is not None:
        af = socket.AF_INET if ':' not in source_address[0] else socket.AF_INET6
        ip_addrs = [addr for addr in ip_addrs if addr[0] == af]
        if not ip_addrs:
            raise OSError(
                f'No remote IPv{4 if af == socket.AF_INET else 6} addresses available for connect. '
                f'Can\'t use "{source_address[0]}" as source address')

    err = None
    for ip_addr in ip_addrs:
        try:
            sock = _create_socket_func(ip_addr, timeout, source_address)
            # Explicitly break __traceback__ reference cycle
            # https://bugs.python.org/issue36820
            err = None
            return sock
        except socket.error as e:
            err = e

    if err is not None:
        try:
            raise err
        finally:
            # Explicitly break __traceback__ reference cycle
            # https://bugs.python.org/issue36820
            err = None


Review comment (bug):
```suggestion
    try:
        raise err
    finally:
        # Explicitly break __traceback__ reference cycle
        # https://bugs.python.org/issue36820
        err = None
```

Code after:
    if source_address is not None:
        af = socket.AF_INET if ':' not in source_address[0] else socket.AF_INET6
        ip_addrs = [addr for addr in ip_addrs if addr[0] == af]
        if not ip_addrs:
            raise OSError(
                f'No remote IPv{4 if af == socket.AF_INET else 6} addresses available for connect. '
                f'Can\'t use "{source_address[0]}" as source address')

    err = None
    for ip_addr in ip_addrs:
        try:
            sock = _create_socket_func(ip_addr, timeout, source_address)
            # Explicitly break __traceback__ reference cycle
            # https://bugs.python.org/issue36820
            err = None
            return sock
        except socket.error as e:
            err = e

    try:
        raise err
    finally:
        # Explicitly break __traceback__ reference cycle
        # https://bugs.python.org/issue36820
        err = None
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/axs.py (Python)

Code before:
from .common import InfoExtractor
from ..utils import (
    float_or_none,
    js_to_json,
    parse_iso8601,
)


class AxsIE(InfoExtractor):
    IE_NAME = 'axs.tv'
    _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/]+/)?video/(?P<id>[^?/]+)'
    _META_URL = 'https://api.myspotlight.tv/dotplayer/video/%s/%s?device_type=desktop_web'

    _TESTS = [{
        'url': 'https://www.axs.tv/video/5f4dc776b70e4f1c194f22ef/',
        'md5': '8d97736ae8e50c64df528e5e676778cf',
        'info_dict': {
            'id': '5f4dc776b70e4f1c194f22ef',
            'title': 'Small Town',
            'ext': 'mp4',
            'description': 'md5:e314d28bfaa227a4d7ec965fae19997f',
            'upload_date': '20230602',
            'timestamp': 1685729564,
            'duration': 1284.216,
            'channel': 'Rock & Roll Road Trip with Sammy Hagar',
            'season': 2,
            'episode': '3',
            'thumbnail': 'https://images.dotstudiopro.com/5f4e9d330a0c3b295a7e8394',
        },
    }, {
        'url': 'https://www.axs.tv/channel/rock-star-interview/video/daryl-hall',
        'md5': '300ae795cd8f9984652c0949734ffbdc',
        'info_dict': {
            'id': '5f488148b70e4f392572977c',
            'title': 'Daryl Hall',
            'ext': 'mp4',

Review comment (suggestion):
exclude both queries and fragments with both character classes
```suggestion
    _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/?#]+/)?video/(?P<id>[^/?#]+)'
```

Code after:
from .common import InfoExtractor
from ..utils import (
    float_or_none,
    js_to_json,
    parse_iso8601,
    traverse_obj,
    url_or_none,
)


class AxsIE(InfoExtractor):
    IE_NAME = 'axs.tv'
    _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/(?:[^/?#]+/)+)?video/(?P<id>[^/?#]+)'

    _TESTS = [{
        'url': 'https://www.axs.tv/video/5f4dc776b70e4f1c194f22ef/',
        'md5': '8d97736ae8e50c64df528e5e676778cf',
        'info_dict': {
            'id': '5f4dc776b70e4f1c194f22ef',
            'title': 'Small Town',
            'ext': 'mp4',
            'description': 'md5:e314d28bfaa227a4d7ec965fae19997f',
            'upload_date': '20230602',
            'timestamp': 1685729564,
            'duration': 1284.216,
            'series': 'Rock & Roll Road Trip with Sammy Hagar',
            'season': 2,
            'episode': '3',
            'thumbnail': 'https://images.dotstudiopro.com/5f4e9d330a0c3b295a7e8394',
        },
    }, {
        'url': 'https://www.axs.tv/channel/rock-star-interview/video/daryl-hall',
        'md5': '300ae795cd8f9984652c0949734ffbdc',
        'info_dict': {
            'id': '5f488148b70e4f392572977c',
            'display_id': 'daryl-hall',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/indavideo.py (Python)

Code before:
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
    int_or_none,
    parse_age_limit,
    parse_iso8601,
    update_url_query,
    time_seconds,
)


class IndavideoEmbedIE(InfoExtractor):
    _VALID_URL = r'https?://(?:(?:embed\.)?indavideo\.hu/player/video/|assets\.indavideo\.hu/swf/player\.swf\?.*\b(?:v(?:ID|id))=)(?P<id>[\da-f]+)'
    # Some example URLs covered by generic extractor:
    #   https://indavideo.hu/video/Vicces_cica_1
    #   https://index.indavideo.hu/video/Hod_Nemetorszagban
    #   https://auto.indavideo.hu/video/Sajat_utanfutoban_a_kis_tacsko
    #   https://film.indavideo.hu/video/f_farkaslesen
    #   https://palyazat.indavideo.hu/video/Embertelen_dal_Dodgem_egyuttes
    _EMBED_REGEX = [r'<iframe[^>]+\bsrc=["\'](?P<url>(?:https?:)//embed\.indavideo\.hu/player/video/[\da-f]+)']
    _TESTS = [{
        'url': 'https://indavideo.hu/player/video/1bdc3c6d80/',
        'md5': 'c8a507a1c7410685f83a06eaeeaafeab',
        'info_dict': {
            'id': '1837039',
            'ext': 'mp4',
            'title': 'Cicatánc',
            'description': '',
            'thumbnail': r're:^https?://.*\.jpg$',
            'uploader': 'cukiajanlo',
            'uploader_id': '83729',
            'timestamp': 1439193826,
            'upload_date': '20150810',

Review comment (suggestion):
```suggestion
    time_seconds,
    update_url_query,
```

Code after:
from .common import InfoExtractor
from ..utils import (
    int_or_none,
    parse_age_limit,
    parse_iso8601,
    time_seconds,
    update_url_query,
)


class IndavideoEmbedIE(InfoExtractor):
    _VALID_URL = r'https?://(?:(?:embed\.)?indavideo\.hu/player/video/|assets\.indavideo\.hu/swf/player\.swf\?.*\b(?:v(?:ID|id))=)(?P<id>[\da-f]+)'
    # Some example URLs covered by generic extractor:
    #   https://indavideo.hu/video/Vicces_cica_1
    #   https://index.indavideo.hu/video/Hod_Nemetorszagban
    #   https://auto.indavideo.hu/video/Sajat_utanfutoban_a_kis_tacsko
    #   https://film.indavideo.hu/video/f_farkaslesen
    #   https://palyazat.indavideo.hu/video/Embertelen_dal_Dodgem_egyuttes
    _EMBED_REGEX = [r'<iframe[^>]+\bsrc=["\'](?P<url>(?:https?:)//embed\.indavideo\.hu/player/video/[\da-f]+)']
    _TESTS = [{
        'url': 'https://indavideo.hu/player/video/1bdc3c6d80/',
        'md5': 'c8a507a1c7410685f83a06eaeeaafeab',
        'info_dict': {
            'id': '1837039',
            'ext': 'mp4',
            'title': 'Cicatánc',
            'description': '',
            'thumbnail': r're:^https?://.*\.jpg$',
            'uploader': 'cukiajanlo',
            'uploader_id': '83729',
            'timestamp': 1439193826,
            'upload_date': '20150810',
            'duration': 72,
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/monstercat.py (Python)

Code before:
                'id': track_id,
                'ext': 'mp3'
            }

    def _real_extract(self, url):
        url_id = self._match_id(url)
        html = self._download_webpage(url, url_id)
        # wrap all `get_elements` in `try_call`, HTMLParser has problems with site's html
        tracklist_table = try_call(lambda: get_element_by_class('table table-small', html)) or ''

        title = try_call(lambda: get_element_text_and_html_by_tag('h1', html)[0])
        date = traverse_obj(html, ({lambda html: get_element_by_class('font-italic mb-medium d-tablet-none d-phone-block',
                            html).partition('Released ')}, 2, {strip_or_none}, {unified_strdate}))

        album_meta = {
            'title': title,
            'album': title,
            'thumbnail': f'https://www.monstercat.com/release/{url_id}/cover',
            'album_artist': try_call(
                lambda: get_element_by_class('h-normal text-uppercase mb-desktop-medium mb-smallish', html)),
            'release_year': int_or_none(date[:4]) if date else None,
            'release_date': date,
        }

        return self.playlist_result(self._extract_tracks(tracklist_table, album_meta),
                                    playlist_id=url_id, **album_meta)


Review comment (refactor):
```suggestion
        return self.playlist_result(
            self._extract_tracks(tracklist_table, album_meta), playlist_id=url_id, **album_meta)
```

Code after:
                'id': track_id,
                'ext': 'mp3'
            }

    def _real_extract(self, url):
        url_id = self._match_id(url)
        html = self._download_webpage(url, url_id)
        # wrap all `get_elements` in `try_call`, HTMLParser has problems with site's html
        tracklist_table = try_call(lambda: get_element_by_class('table table-small', html)) or ''

        title = try_call(lambda: get_element_text_and_html_by_tag('h1', html)[0])
        date = traverse_obj(html, ({lambda html: get_element_by_class('font-italic mb-medium d-tablet-none d-phone-block',
                            html).partition('Released ')}, 2, {strip_or_none}, {unified_strdate}))

        album_meta = {
            'title': title,
            'album': title,
            'thumbnail': f'https://www.monstercat.com/release/{url_id}/cover',
            'album_artist': try_call(
                lambda: get_element_by_class('h-normal text-uppercase mb-desktop-medium mb-smallish', html)),
            'release_year': int_or_none(date[:4]) if date else None,
            'release_date': date,
        }

        return self.playlist_result(
            self._extract_tracks(tracklist_table, album_meta), playlist_id=url_id, **album_meta)
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/cineverse.py (Python)

Code before:
from .common import InfoExtractor
from ..utils import (
    int_or_none,
    iri_to_uri,
    parse_age_limit,
    smuggle_url,
    traverse_obj,
    unsmuggle_url,
)


class CineverseBaseIE(InfoExtractor):
    _VALID_URL_BASE = r'https://www\.(?P<host>(?:cineverse|asiancrush|dovechannel|screambox|midnightpulp|fandor).com|retrocrush\.tv)'


class CineverseIE(CineverseBaseIE):
    _VALID_URL = r'%s/watch/(?P<id>[A-Z0-9]+)' % CineverseBaseIE._VALID_URL_BASE
    _TESTS = [{
        'url': 'https://www.asiancrush.com/watch/DMR00018919/Women-Who-Flirt',
        'skip': 'geo-blocked',
        'info_dict': {
            'title': 'Women Who Flirt',
            'ext': 'mp4',
            'id': 'DMR00018919',
            'modified_timestamp': 1678744575289,
            'cast': ['Xun Zhou', 'Xiaoming Huang', 'Yi-Lin Sie', 'Sonia Sui', 'Quniciren'],
            'duration': 5811.597,
            'description': 'md5:892fd62a05611d394141e8394ace0bc6',
            'age_limit': 13,
        }
    }, {
        'url': 'https://www.retrocrush.tv/watch/1000000023016/Archenemy! Crystal Bowie',
        'skip': 'geo-blocked',
        'info_dict': {
            'title': 'Archenemy! Crystal Bowie',
            'ext': 'mp4',
            'id': '1000000023016',
            'episode_number': 3,

Review comment (security):
missed an escape
```suggestion
    _VALID_URL_BASE = r'https://www\.(?P<host>(?:cineverse|asiancrush|dovechannel|screambox|midnightpulp|fandor)\.com|retrocrush\.tv)'
```
&nbsp;
or this may be more readable / maintainable
```suggestion
    _VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, (
        'cineverse.com',
        'asiancrush.com',
        'dovechannel.com',
        'screambox.com',
        'midnightpulp.com',
        'fandor.com',
        'retrocrush.tv',
    )))
```

Code after:
import re

from .common import InfoExtractor
from ..utils import (
    filter_dict,
    int_or_none,
    parse_age_limit,
    smuggle_url,
    traverse_obj,
    unsmuggle_url,
    url_or_none,
)


class CineverseBaseIE(InfoExtractor):
    _VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, (
        'cineverse.com',
        'asiancrush.com',
        'dovechannel.com',
        'screambox.com',
        'midnightpulp.com',
        'fandor.com',
        'retrocrush.tv',
    )))


class CineverseIE(CineverseBaseIE):
    _VALID_URL = rf'{CineverseBaseIE._VALID_URL_BASE}/watch/(?P<id>[A-Z0-9]+)'
    _TESTS = [{
        'url': 'https://www.asiancrush.com/watch/DMR00018919/Women-Who-Flirt',
        'skip': 'geo-blocked',
        'info_dict': {
            'title': 'Women Who Flirt',
            'ext': 'mp4',
            'id': 'DMR00018919',
            'modified_timestamp': 1678744575289,
            'cast': ['Xun Zhou', 'Xiaoming Huang', 'Yi-Lin Sie', 'Sonia Sui', 'Quniciren'],
            'duration': 5811.597,
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/cineverse.py (Python)

Code before:
import re

from .common import InfoExtractor
from ..utils import (
    filter_dict,
    int_or_none,
    iri_to_uri,
    parse_age_limit,
    smuggle_url,
    traverse_obj,
    unsmuggle_url,
    url_or_none,
)


class CineverseBaseIE(InfoExtractor):
        _VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, (
        'cineverse.com',
        'asiancrush.com',
        'dovechannel.com',
        'screambox.com',
        'midnightpulp.com',
        'fandor.com',
        'retrocrush.tv',
    )))


class CineverseIE(CineverseBaseIE):
    _VALID_URL = r'%s/watch/(?P<id>[A-Z0-9]+)' % CineverseBaseIE._VALID_URL_BASE
    _TESTS = [{
        'url': 'https://www.asiancrush.com/watch/DMR00018919/Women-Who-Flirt',
        'skip': 'geo-blocked',
        'info_dict': {
            'title': 'Women Who Flirt',
            'ext': 'mp4',
            'id': 'DMR00018919',
            'modified_timestamp': 1678744575289,
            'cast': ['Xun Zhou', 'Xiaoming Huang', 'Yi-Lin Sie', 'Sonia Sui', 'Quniciren'],
            'duration': 5811.597,
            'description': 'md5:892fd62a05611d394141e8394ace0bc6',
            'age_limit': 13,
        }

Review comment (security):
```suggestion
    _VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, (
```

Code after:
import re

from .common import InfoExtractor
from ..utils import (
    filter_dict,
    int_or_none,
    parse_age_limit,
    smuggle_url,
    traverse_obj,
    unsmuggle_url,
    url_or_none,
)


class CineverseBaseIE(InfoExtractor):
    _VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, (
        'cineverse.com',
        'asiancrush.com',
        'dovechannel.com',
        'screambox.com',
        'midnightpulp.com',
        'fandor.com',
        'retrocrush.tv',
    )))


class CineverseIE(CineverseBaseIE):
    _VALID_URL = rf'{CineverseBaseIE._VALID_URL_BASE}/watch/(?P<id>[A-Z0-9]+)'
    _TESTS = [{
        'url': 'https://www.asiancrush.com/watch/DMR00018919/Women-Who-Flirt',
        'skip': 'geo-blocked',
        'info_dict': {
            'title': 'Women Who Flirt',
            'ext': 'mp4',
            'id': 'DMR00018919',
            'modified_timestamp': 1678744575289,
            'cast': ['Xun Zhou', 'Xiaoming Huang', 'Yi-Lin Sie', 'Sonia Sui', 'Quniciren'],
            'duration': 5811.597,
            'description': 'md5:892fd62a05611d394141e8394ace0bc6',
            'age_limit': 13,
        }
    }, {
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/_extractors.py (Python)

Code before:
# flake8: noqa: F401
from .tudou import(TudouIE,


    )

from .youtube import (  # Youtube is moved to the top to improve performance
    YoutubeIE,
    YoutubeClipIE,
    YoutubeFavouritesIE,
    YoutubeNotificationsIE,
    YoutubeHistoryIE,
    YoutubeTabIE,
    YoutubeLivestreamEmbedIE,
    YoutubePlaylistIE,
    YoutubeRecommendedIE,
    YoutubeSearchDateIE,
    YoutubeSearchIE,
    YoutubeSearchURLIE,
    YoutubeMusicSearchURLIE,
    YoutubeSubscriptionsIE,
    YoutubeTruncatedIDIE,
    YoutubeTruncatedURLIE,
    YoutubeYtBeIE,
    YoutubeYtUserIE,
    YoutubeWatchLaterIE,
    YoutubeShortsAudioPivotIE,
    YoutubeConsentRedirectIE,
)


Review comment (suggestion):
file this alphabetically below

and you can just do
```py
from .tudou import TudouIE
```

Code after:
# flake8: noqa: F401

from .youtube import (  # Youtube is moved to the top to improve performance
    YoutubeIE,
    YoutubeClipIE,
    YoutubeFavouritesIE,
    YoutubeNotificationsIE,
    YoutubeHistoryIE,
    YoutubeTabIE,
    YoutubeLivestreamEmbedIE,
    YoutubePlaylistIE,
    YoutubeRecommendedIE,
    YoutubeSearchDateIE,
    YoutubeSearchIE,
    YoutubeSearchURLIE,
    YoutubeMusicSearchURLIE,
    YoutubeSubscriptionsIE,
    YoutubeTruncatedIDIE,
    YoutubeTruncatedURLIE,
    YoutubeYtBeIE,
    YoutubeYtUserIE,
    YoutubeWatchLaterIE,
    YoutubeShortsAudioPivotIE,
    YoutubeConsentRedirectIE,
)

from .abc import (
    ABCIE,
    ABCIViewIE,
    ABCIViewShowSeriesIE,
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/eltrecetv.py (Python)

Code before:
            }
        },
        {
            'url': 'https://www.eltrecetv.com.ar/argentina-tierra-de-amor-y-venganza/capitulos/temporada-2023/atav-2-capitulo-121-del-250923/',
            'only_matching': True,
        },
        {
            'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-2023/programa-del-250923/',
            'only_matching': True,
        },
        {
            'url': 'https://www.eltrecetv.com.ar/pasaplatos/capitulos/temporada-2023/pasaplatos-el-restaurante-del-250923/',
            'only_matching': True,
        },
        {
            'url': 'https://www.eltrecetv.com.ar/el-galpon/capitulos/temporada-2023/programa-del-160923-invitado-raul-lavie/',
            'only_matching': True,
        }
    ]

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

        video_id = self._search_regex(r'https://vod\.vodgc\.net/manifest/([A-Z0-9]+)\.m3u8', webpage, 'video_id')
        title = self._search_regex(r',"title":"(.+?)",', webpage, 'title')

        return {
            'id': video_id,
            'title': title,
            'url': 'https://vod.vodgc.net/gid1/vod/Artear/Eltrece/75/%s_720P.mp4' % video_id,
            'thumbnail': 'https://thumbs.vodgc.net/%s.jpg' % video_id,
        }


Review comment (suggestion):
these come from an embedded json blob (`Fusion.globalContent`)
it might be better to match the whole json with `_search_json`, then traverse it to get the details you need
that way you can be more resilient to eg the vod provider changing

Code after:
        },
        {
            'url': 'https://www.eltrecetv.com.ar/pasaplatos/capitulos/temporada-2023/pasaplatos-el-restaurante-del-250923/',
            'only_matching': True,
        },
        {
            'url': 'https://www.eltrecetv.com.ar/el-galpon/capitulos/temporada-2023/programa-del-160923-invitado-raul-lavie/',
            'only_matching': True,
        }
    ]

    def _real_extract(self, url):
        slug = self._match_id(url)
        webpage = self._download_webpage(url, slug)
        config = self._search_json(
            r'Fusion.globalContent\s*=', webpage, 'content', slug)['promo_items']['basic']['embed']['config']
        video_url = config['m3u8']
        video_id = self._search_regex(r'/(\w+)\.m3u8', video_url, 'video id', default=slug)

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_url, video_id, 'mp4', m3u8_id='hls')
        formats.extend([{
            'url': f['url'][:-23],
            'format_id': f['format_id'].replace('hls', 'http'),
            'width': f.get('width'),
            'height': f.get('height'),
        } for f in formats if f['url'].endswith('/tracks-v1a1/index.m3u8') and f.get('height') != 1080])

        return {
            'id': video_id,
            'title': config.get('title'),
            'thumbnail': config.get('thumbnail'),
            'formats': formats,
            'subtitles': subtitles,
        }