SolarFM/plugins/youtube_download/yt_dlp/extractor/matchtv.py

36 lines
1.2 KiB
Python
Raw Normal View History

from .common import InfoExtractor
class MatchTVIE(InfoExtractor):
2025-05-02 21:11:08 +00:00
_VALID_URL = [
r'https?://matchtv\.ru/on-air/?(?:$|[?#])',
r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])',
]
_TESTS = [{
2025-05-02 21:11:08 +00:00
'url': 'http://matchtv.ru/on-air/',
'info_dict': {
'id': 'matchtv-live',
2025-05-02 21:11:08 +00:00
'ext': 'mp4',
'title': r're:^Матч ТВ - Прямой эфир \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
2025-05-02 21:11:08 +00:00
'live_status': 'is_live',
},
'params': {
'skip_download': True,
},
}, {
2025-05-02 21:11:08 +00:00
'url': 'https://video.matchtv.ru/iframe/channel/106',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = 'matchtv-live'
2025-05-02 21:11:08 +00:00
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'
return {
'id': video_id,
'title': 'Матч ТВ - Прямой эфир',
'is_live': True,
2025-05-02 21:11:08 +00:00
'formats': self._extract_m3u8_formats(video_url, video_id, 'mp4', live=True),
}