]>
Commit | Line | Data |
---|---|---|
1 | from .common import InfoExtractor | |
2 | ||
3 | ||
4 | class WeiqiTVIE(InfoExtractor): | |
5 | _WORKING = False | |
6 | IE_DESC = 'WQTV' | |
7 | _VALID_URL = r'https?://(?:www\.)?weiqitv\.com/index/video_play\?videoId=(?P<id>[A-Za-z0-9]+)' | |
8 | ||
9 | _TESTS = [{ | |
10 | 'url': 'http://www.weiqitv.com/index/video_play?videoId=53c744f09874f0e76a8b46f3', | |
11 | 'md5': '26450599afd64c513bc77030ad15db44', | |
12 | 'info_dict': { | |
13 | 'id': '53c744f09874f0e76a8b46f3', | |
14 | 'ext': 'mp4', | |
15 | 'title': '2013年度盘点', | |
16 | }, | |
17 | }, { | |
18 | 'url': 'http://www.weiqitv.com/index/video_play?videoId=567379a2d4c36cca518b4569', | |
19 | 'info_dict': { | |
20 | 'id': '567379a2d4c36cca518b4569', | |
21 | 'ext': 'mp4', | |
22 | 'title': '民国围棋史', | |
23 | }, | |
24 | }, { | |
25 | 'url': 'http://www.weiqitv.com/index/video_play?videoId=5430220a9874f088658b4567', | |
26 | 'info_dict': { | |
27 | 'id': '5430220a9874f088658b4567', | |
28 | 'ext': 'mp4', | |
29 | 'title': '二路托过的手段和运用', | |
30 | }, | |
31 | }] | |
32 | ||
33 | def _real_extract(self, url): | |
34 | media_id = self._match_id(url) | |
35 | page = self._download_webpage(url, media_id) | |
36 | ||
37 | info_json_str = self._search_regex( | |
38 | r'var\s+video\s*=\s*(.+});', page, 'info json str') | |
39 | info_json = self._parse_json(info_json_str, media_id) | |
40 | ||
41 | letvcloud_url = self._search_regex( | |
42 | r'var\s+letvurl\s*=\s*"([^"]+)', page, 'letvcloud url') | |
43 | ||
44 | return { | |
45 | '_type': 'url_transparent', | |
46 | 'ie_key': 'LetvCloud', | |
47 | 'url': letvcloud_url, | |
48 | 'title': info_json['name'], | |
49 | 'id': media_id, | |
50 | } |