]>
Commit | Line | Data |
---|---|---|
1 | import random | |
2 | ||
3 | from .common import InfoExtractor | |
4 | from ..utils import xpath_text | |
5 | ||
6 | ||
7 | class MatchTVIE(InfoExtractor): | |
8 | _VALID_URL = r'https?://matchtv\.ru(?:/on-air|/?#live-player)' | |
9 | _TESTS = [{ | |
10 | 'url': 'http://matchtv.ru/#live-player', | |
11 | 'info_dict': { | |
12 | 'id': 'matchtv-live', | |
13 | 'ext': 'flv', | |
14 | 'title': r're:^Матч ТВ - Прямой эфир \d{4}-\d{2}-\d{2} \d{2}:\d{2}$', | |
15 | 'is_live': True, | |
16 | }, | |
17 | 'params': { | |
18 | 'skip_download': True, | |
19 | }, | |
20 | }, { | |
21 | 'url': 'http://matchtv.ru/on-air/', | |
22 | 'only_matching': True, | |
23 | }] | |
24 | ||
25 | def _real_extract(self, url): | |
26 | video_id = 'matchtv-live' | |
27 | video_url = self._download_json( | |
28 | 'http://player.matchtv.ntvplus.tv/player/smil', video_id, | |
29 | query={ | |
30 | 'ts': '', | |
31 | 'quality': 'SD', | |
32 | 'contentId': '561d2c0df7159b37178b4567', | |
33 | 'sign': '', | |
34 | 'includeHighlights': '0', | |
35 | 'userId': '', | |
36 | 'sessionId': random.randint(1, 1000000000), | |
37 | 'contentType': 'channel', | |
38 | 'timeShift': '0', | |
39 | 'platform': 'portal', | |
40 | }, | |
41 | headers={ | |
42 | 'Referer': 'http://player.matchtv.ntvplus.tv/embed-player/NTVEmbedPlayer.swf', | |
43 | })['data']['videoUrl'] | |
44 | f4m_url = xpath_text(self._download_xml(video_url, video_id), './to') | |
45 | formats = self._extract_f4m_formats(f4m_url, video_id) | |
46 | return { | |
47 | 'id': video_id, | |
48 | 'title': 'Матч ТВ - Прямой эфир', | |
49 | 'is_live': True, | |
50 | 'formats': formats, | |
51 | } |