]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/matchtv.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / matchtv.py
CommitLineData
c3deacd5 1from .common import InfoExtractor
c3deacd5
S
2
3
4class MatchTVIE(InfoExtractor):
f3411af1 5 _VALID_URL = [
6 r'https?://matchtv\.ru/on-air/?(?:$|[?#])',
7 r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])',
8 ]
80ae228b 9 _TESTS = [{
f3411af1 10 'url': 'http://matchtv.ru/on-air/',
c3deacd5
S
11 'info_dict': {
12 'id': 'matchtv-live',
f3411af1 13 'ext': 'mp4',
ec85ded8 14 'title': r're:^Матч ТВ - Прямой эфир \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
f3411af1 15 'live_status': 'is_live',
c3deacd5
S
16 },
17 'params': {
18 'skip_download': True,
19 },
80ae228b 20 }, {
f3411af1 21 'url': 'https://video.matchtv.ru/iframe/channel/106',
80ae228b
S
22 'only_matching': True,
23 }]
c3deacd5
S
24
25 def _real_extract(self, url):
26 video_id = 'matchtv-live'
f3411af1 27 webpage = self._download_webpage('https://video.matchtv.ru/iframe/channel/106', video_id)
28 video_url = self._html_search_regex(
29 r'data-config="config=(https?://[^?"]+)[?"]', webpage, 'video URL').replace('/feed/', '/media/') + '.m3u8'
c3deacd5
S
30 return {
31 'id': video_id,
39ca3b5c 32 'title': 'Матч ТВ - Прямой эфир',
c3deacd5 33 'is_live': True,
f3411af1 34 'formats': self._extract_m3u8_formats(video_url, video_id, 'mp4', live=True),
c3deacd5 35 }