]>
Commit | Line | Data |
---|---|---|
5f6a1245 | 1 | # coding: utf-8 |
018e8355 PH |
2 | from __future__ import unicode_literals |
3 | ||
8f4a2124 YCH |
4 | from .jwplatform import JWPlatformBaseIE |
5 | from ..utils import ( | |
efbd6fb8 | 6 | decode_packed_codes, |
8f4a2124 YCH |
7 | js_to_json, |
8 | ) | |
018e8355 | 9 | |
8f4a2124 YCH |
10 | |
11 | class VidziIE(JWPlatformBaseIE): | |
95ee8442 | 12 | _VALID_URL = r'https?://(?:www\.)?vidzi\.tv/(?P<id>\w+)' |
13 | _TEST = { | |
2c26df76 PH |
14 | 'url': 'http://vidzi.tv/cghql9yq6emu.html', |
15 | 'md5': '4f16c71ca0c8c8635ab6932b5f3f1660', | |
95ee8442 | 16 | 'info_dict': { |
2c26df76 | 17 | 'id': 'cghql9yq6emu', |
95ee8442 | 18 | 'ext': 'mp4', |
2c26df76 | 19 | 'title': 'youtube-dl test video 1\\\\2\'3/4<5\\\\6ä7↭', |
bd93a12e YCH |
20 | }, |
21 | 'params': { | |
22 | # m3u8 download | |
23 | 'skip_download': True, | |
95ee8442 | 24 | }, |
25 | } | |
26 | ||
27 | def _real_extract(self, url): | |
018e8355 | 28 | video_id = self._match_id(url) |
5f6a1245 | 29 | |
018e8355 | 30 | webpage = self._download_webpage(url, video_id) |
018e8355 | 31 | title = self._html_search_regex( |
2c26df76 | 32 | r'(?s)<h2 class="video-title">(.*?)</h2>', webpage, 'title') |
5f6a1245 | 33 | |
efbd6fb8 | 34 | code = decode_packed_codes(webpage).replace('\\\'', '\'') |
8f4a2124 YCH |
35 | jwplayer_data = self._parse_json( |
36 | self._search_regex(r'setup\(([^)]+)\)', code, 'jwplayer data'), | |
37 | video_id, transform_source=js_to_json) | |
38 | ||
39 | info_dict = self._parse_jwplayer_data(jwplayer_data, video_id, require_title=False) | |
40 | info_dict['title'] = title | |
41 | ||
42 | return info_dict |