yt-dlp/yt_dlp/extractor/matchtv.py

36 lines
1.2 KiB
Python
Raw Normal View History

2016-01-30 12:30:27 +00:00
from .common import InfoExtractor
class MatchTVIE(InfoExtractor):
_VALID_URL = [
r'https?://matchtv\.ru/on-air/?(?:$|[?#])',
r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])',
]
2016-06-11 18:57:23 +00:00
_TESTS = [{
'url': 'http://matchtv.ru/on-air/',
2016-01-30 12:30:27 +00:00
'info_dict': {
'id': 'matchtv-live',
'ext': 'mp4',
'title': r're:^Матч ТВ - Прямой эфир \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
'live_status': 'is_live',
2016-01-30 12:30:27 +00:00
},
'params': {
'skip_download': True,
},
2016-06-11 18:57:23 +00:00
}, {
'url': 'https://video.matchtv.ru/iframe/channel/106',
2016-06-11 18:57:23 +00:00
'only_matching': True,
}]
2016-01-30 12:30:27 +00:00
def _real_extract(self, url):
video_id = 'matchtv-live'
webpage = self._download_webpage('https://video.matchtv.ru/iframe/channel/106', video_id)
video_url = self._html_search_regex(
r'data-config="config=(https?://[^?"]+)[?"]', webpage, 'video URL').replace('/feed/', '/media/') + '.m3u8'
2016-01-30 12:30:27 +00:00
return {
'id': video_id,
2021-12-15 16:00:46 +00:00
'title': 'Матч ТВ - Прямой эфир',
2016-01-30 12:30:27 +00:00
'is_live': True,
'formats': self._extract_m3u8_formats(video_url, video_id, 'mp4', live=True),
2016-01-30 12:30:27 +00:00
}