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

Code before:
            'release_date': '20231015',
            'age_limit': 15,
            'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/soccer3/img/20231008_210957_775_1.jpg',
            'series': '뭉쳐야 찬다3',
        },
    }, {
        'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/view',
        'md5': '217a6d190f115a75e4bda0ceaa4cd7f4',
        'info_dict': {
            'id': 'vo10720912',
            'ext': 'mp4',
            'title': '아는 형님 404회 예고편 | 10월 14일(토) 저녁 8시 50분 방송!',
            'description': 'md5:2743bb1079ceb85bb00060f2ad8f0280',
            'duration': 148.0,
            'release_date': '20231014',
            'age_limit': 15,
            'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/jtbcbros/img/20231006_230023_802_1.jpg',
            'series': '아는 형님',
        },
    }]

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

        file_id = self._search_regex(r'data-vod="(VO[0-9]+)"', webpage, 'vod_id')

        metadata = self._download_json(
            f'https://now-api.jtbc.co.kr/v1/vod/detail?vodFileId={file_id}',
            video_id, note='Downloading mobile details', fatal=False)

        playback_data = self._download_json(
            f'https://api.jtbc.co.kr/vod/{file_id}', video_id, note='Downloading VOD playback data')

        subtitles = {}
        for sub in playback_data.get('tracks', []):
            subtitles.setdefault(sub.get('label', 'und'), []).append({'url': sub.get('file')})

        formats = []
        for format_id, stream in traverse_obj(playback_data, ('sources', 'HLS'), default={}).items():
            m3u8_url = re.sub(r'/playlist(?:_pd180000)?\.m3u8', '/index.m3u8', stream.get('file'))
            formats.extend(self._extract_m3u8_formats(m3u8_url, video_id, m3u8_id=format_id))

        return {
            'id': video_id,
            **traverse_obj(metadata, ('vodDetail', {
                'title': 'vodTitleView',
                'series': 'programTitle',
                'age_limit': 'watchAge',
                'release_date': ('broadcastDate', {lambda x: re.match(r'\d{8}', x.replace('.', ''))}, 0),
                'description': 'episodeContents',

Review comment (suggestion):
nitpick: `name` arg is intended to be human readable / not just var name / avoid underscores etc
```suggestion
        file_id = self._search_regex(r'data-vod="(VO\d+)"', webpage, 'vod id')
```

Code after:
        'url': 'https://vod.jtbc.co.kr/player/clip/vo10721270',
        'md5': '05782e2dc22a9c548aebefe62ae4328a',
        'info_dict': {
            'id': 'VO10721270',
            'display_id': 'vo10721270',
            'ext': 'mp4',
            'title': '뭉쳐야 찬다3 2회 예고편 - A매치로 향하는 마지막 관문💥',
            'description': 'md5:d48b51a8655c84843b4ed8d0c39aae68',
            'duration': 46.0,
            'release_date': '20231015',
            'age_limit': 15,
            'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/soccer3/img/20231008_210957_775_1.jpg',
            'series': '뭉쳐야 찬다3',
        },
    }, {
        'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/view',
        'md5': '367d480eb3ef54a9cd7a4b4d69c4b32d',
        'info_dict': {
            'id': 'VO10720912',
            'display_id': 'vo10720912',
            'ext': 'mp4',
            'title': '아는 형님 404회 예고편 | 10월 14일(토) 저녁 8시 50분 방송!',
            'description': 'md5:2743bb1079ceb85bb00060f2ad8f0280',
            'duration': 148.0,
            'release_date': '20231014',
            'age_limit': 15,
            'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/jtbcbros/img/20231006_230023_802_1.jpg',
            'series': '아는 형님',
        },
    }]

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

        if display_id.startswith('vo'):
            video_id = display_id.upper()
        else:
            webpage = self._download_webpage(url, display_id)
            video_id = self._search_regex(r'data-vod="(VO\d+)"', webpage, 'vod id')

        playback_data = self._download_json(
            f'https://api.jtbc.co.kr/vod/{video_id}', video_id, note='Downloading VOD playback data')

        subtitles = {}
        for sub in traverse_obj(playback_data, ('tracks', lambda _, v: v['file'])):
            subtitles.setdefault(sub.get('label', 'und'), []).append({'url': sub['file']})

        formats = []
        for stream_url in traverse_obj(playback_data, ('sources', 'HLS', ..., 'file', {url_or_none})):
            stream_url = re.sub(r'/playlist(?:_pd\d+)?\.m3u8', '/index.m3u8', stream_url)
            formats.extend(self._extract_m3u8_formats(stream_url, video_id, fatal=False))