]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/c56.py
2 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..utils
import js_to_json
9 class C56IE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:(?:www|player)\.)?56\.com/(?:.+?/)?(?:v_|(?:play_album.+-))(?P<textid>.+?)\.(?:html|swf)'
13 'url': 'http://www.56.com/u39/v_OTM0NDA3MTY.html',
14 'md5': 'e59995ac63d0457783ea05f93f12a866',
18 'title': '网事知多少 第32期:车怒',
22 'url': 'http://www.56.com/u47/v_MTM5NjQ5ODc2.html',
32 def _real_extract(self
, url
):
33 mobj
= self
._match
_valid
_url
(url
)
34 text_id
= mobj
.group('textid')
36 webpage
= self
._download
_webpage
(url
, text_id
)
37 sohu_video_info_str
= self
._search
_regex
(
38 r
'var\s+sohuVideoInfo\s*=\s*({[^}]+});', webpage
, 'Sohu video info', default
=None)
39 if sohu_video_info_str
:
40 sohu_video_info
= self
._parse
_json
(
41 sohu_video_info_str
, text_id
, transform_source
=js_to_json
)
42 return self
.url_result(sohu_video_info
['url'], 'Sohu')
44 page
= self
._download
_json
(
45 'http://vxml.56.com/json/%s/' % text_id
, text_id
, 'Downloading video info')
51 'format_id': f
['type'],
52 'filesize': int(f
['filesize']),
54 } for f
in info
['rfiles']
56 self
._sort
_formats
(formats
)
60 'title': info
['Subject'],
61 'duration': int(info
['duration']) / 1000.0,
63 'thumbnail': info
.get('bimg') or info
.get('img'),