]>
Commit | Line | Data |
---|---|---|
e4d6cca0 | 1 | import re |
2 | ||
bd7fe0cf | 3 | from .common import InfoExtractor |
7bc8780c S |
4 | from ..utils import ( |
5 | xpath_text, | |
6 | int_or_none, | |
7 | ) | |
e4d6cca0 | 8 | |
9 | ||
bd7fe0cf | 10 | class WallaIE(InfoExtractor): |
5886b38d | 11 | _VALID_URL = r'https?://vod\.walla\.co\.il/[^/]+/(?P<id>\d+)/(?P<display_id>.+)' |
e4d6cca0 | 12 | _TEST = { |
13 | 'url': 'http://vod.walla.co.il/movie/2642630/one-direction-all-for-one', | |
14 | 'info_dict': { | |
15 | 'id': '2642630', | |
7bc8780c | 16 | 'display_id': 'one-direction-all-for-one', |
e4d6cca0 | 17 | 'ext': 'flv', |
18 | 'title': 'וואן דיירקשן: ההיסטריה', | |
7bc8780c | 19 | 'description': 'md5:de9e2512a92442574cdb0913c49bc4d8', |
ec85ded8 | 20 | 'thumbnail': r're:^https?://.*\.jpg', |
7bc8780c S |
21 | 'duration': 3600, |
22 | }, | |
23 | 'params': { | |
24 | # rtmp download | |
25 | 'skip_download': True, | |
e4d6cca0 | 26 | } |
27 | } | |
28 | ||
7bc8780c S |
29 | _SUBTITLE_LANGS = { |
30 | 'עברית': 'heb', | |
31 | } | |
32 | ||
e4d6cca0 | 33 | def _real_extract(self, url): |
5ad28e7f | 34 | mobj = self._match_valid_url(url) |
e4d6cca0 | 35 | video_id = mobj.group('id') |
7bc8780c | 36 | display_id = mobj.group('display_id') |
e4d6cca0 | 37 | |
7bc8780c S |
38 | video = self._download_xml( |
39 | 'http://video2.walla.co.il/?w=null/null/%s/@@/video/flv_pl' % video_id, | |
40 | display_id) | |
e4d6cca0 | 41 | |
7bc8780c | 42 | item = video.find('./items/item') |
e4d6cca0 | 43 | |
7bc8780c S |
44 | title = xpath_text(item, './title', 'title') |
45 | description = xpath_text(item, './synopsis', 'description') | |
46 | thumbnail = xpath_text(item, './preview_pic', 'thumbnail') | |
47 | duration = int_or_none(xpath_text(item, './duration', 'duration')) | |
e4d6cca0 | 48 | |
49 | subtitles = {} | |
7bc8780c S |
50 | for subtitle in item.findall('./subtitles/subtitle'): |
51 | lang = xpath_text(subtitle, './title') | |
bd7fe0cf JMF |
52 | subtitles[self._SUBTITLE_LANGS.get(lang, lang)] = [{ |
53 | 'ext': 'srt', | |
54 | 'url': xpath_text(subtitle, './src'), | |
55 | }] | |
7bc8780c S |
56 | |
57 | formats = [] | |
58 | for quality in item.findall('./qualities/quality'): | |
59 | format_id = xpath_text(quality, './title') | |
60 | fmt = { | |
61 | 'url': 'rtmp://wafla.walla.co.il/vod', | |
62 | 'play_path': xpath_text(quality, './src'), | |
63 | 'player_url': 'http://isc.walla.co.il/w9/swf/video_swf/vod/WallaMediaPlayerAvod.swf', | |
64 | 'page_url': url, | |
65 | 'ext': 'flv', | |
66 | 'format_id': xpath_text(quality, './title'), | |
67 | } | |
68 | m = re.search(r'^(?P<height>\d+)[Pp]', format_id) | |
69 | if m: | |
70 | fmt['height'] = int(m.group('height')) | |
71 | formats.append(fmt) | |
e4d6cca0 | 72 | |
73 | return { | |
74 | 'id': video_id, | |
7bc8780c | 75 | 'display_id': display_id, |
e4d6cca0 | 76 | 'title': title, |
7bc8780c S |
77 | 'description': description, |
78 | 'thumbnail': thumbnail, | |
79 | 'duration': duration, | |
80 | 'formats': formats, | |
e4d6cca0 | 81 | 'subtitles': subtitles, |
7bc8780c | 82 | } |