]>
Commit | Line | Data |
---|---|---|
1de32771 | 1 | from .common import InfoExtractor |
2 | from ..utils import ( | |
3 | xpath_text, | |
4 | parse_duration, | |
5 | ExtractorError, | |
6 | ) | |
7 | ||
8 | ||
9 | class EyedoTVIE(InfoExtractor): | |
10 | _VALID_URL = r'https?://(?:www\.)?eyedo\.tv/[^/]+/(?:#!/)?Live/Detail/(?P<id>[0-9]+)' | |
11 | _TEST = { | |
12 | 'url': 'https://www.eyedo.tv/en-US/#!/Live/Detail/16301', | |
13 | 'md5': 'ba14f17995cdfc20c36ba40e21bf73f7', | |
14 | 'info_dict': { | |
15 | 'id': '16301', | |
16 | 'ext': 'mp4', | |
17 | 'title': 'Journée du conseil scientifique de l\'Afnic 2015', | |
18 | 'description': 'md5:4abe07293b2f73efc6e1c37028d58c98', | |
19 | 'uploader': 'Afnic Live', | |
20 | 'uploader_id': '8023', | |
21 | } | |
22 | } | |
23 | _ROOT_URL = 'http://live.eyedo.net:1935/' | |
24 | ||
25 | def _real_extract(self, url): | |
26 | video_id = self._match_id(url) | |
27 | video_data = self._download_xml('http://eyedo.tv/api/live/GetLive/%s' % video_id, video_id) | |
28 | ||
29 | def _add_ns(path): | |
30 | return self._xpath_ns(path, 'http://schemas.datacontract.org/2004/07/EyeDo.Core.Implementation.Web.ViewModels.Api') | |
31 | ||
32 | title = xpath_text(video_data, _add_ns('Titre'), 'title', True) | |
33 | state_live_code = xpath_text(video_data, _add_ns('StateLiveCode'), 'title', True) | |
34 | if state_live_code == 'avenir': | |
35 | raise ExtractorError( | |
36 | '%s said: We\'re sorry, but this video is not yet available.' % self.IE_NAME, | |
37 | expected=True) | |
38 | ||
39 | is_live = state_live_code == 'live' | |
40 | m3u8_url = None | |
41 | # http://eyedo.tv/Content/Html5/Scripts/html5view.js | |
42 | if is_live: | |
43 | if xpath_text(video_data, 'Cdn') == 'true': | |
44 | m3u8_url = 'http://rrr.sz.xlcdn.com/?account=eyedo&file=A%s&type=live&service=wowza&protocol=http&output=playlist.m3u8' % video_id | |
45 | else: | |
46 | m3u8_url = self._ROOT_URL + 'w/%s/eyedo_720p/playlist.m3u8' % video_id | |
47 | else: | |
48 | m3u8_url = self._ROOT_URL + 'replay-w/%s/mp4:%s.mp4/playlist.m3u8' % (video_id, video_id) | |
49 | ||
50 | return { | |
51 | 'id': video_id, | |
52 | 'title': title, | |
53 | 'formats': self._extract_m3u8_formats( | |
fb4fc449 | 54 | m3u8_url, video_id, 'mp4', 'm3u8_native'), |
1de32771 | 55 | 'description': xpath_text(video_data, _add_ns('Description')), |
56 | 'duration': parse_duration(xpath_text(video_data, _add_ns('Duration'))), | |
57 | 'uploader': xpath_text(video_data, _add_ns('Createur')), | |
58 | 'uploader_id': xpath_text(video_data, _add_ns('CreateurId')), | |
59 | 'chapter': xpath_text(video_data, _add_ns('ChapitreTitre')), | |
60 | 'chapter_id': xpath_text(video_data, _add_ns('ChapitreId')), | |
61 | } |