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