]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/c56.py
dc3a8d47d164912590d88d42c0fc072a99faeee4
6 from .common
import InfoExtractor
7 from ..utils
import determine_ext
9 class C56IE(InfoExtractor
):
10 _VALID_URL
= r
'https?://((www|player)\.)?56\.com/(.+?/)?(v_|(play_album.+-))(?P<textid>.+?)\.(html|swf)'
14 u
'url': u
'http://www.56.com/u39/v_OTM0NDA3MTY.html',
15 u
'file': u
'93440716.flv',
16 u
'md5': u
'e59995ac63d0457783ea05f93f12a866',
18 u
'title': u
'网事知多少 第32期:车怒',
22 def _real_extract(self
, url
):
23 mobj
= re
.match(self
._VALID
_URL
, url
, flags
=re
.VERBOSE
)
24 text_id
= mobj
.group('textid')
25 info_page
= self
._download
_webpage
('http://vxml.56.com/json/%s/' % text_id
,
26 text_id
, u
'Downloading video info')
27 info
= json
.loads(info_page
)['info']
28 best_format
= sorted(info
['rfiles'], key
=lambda f
: int(f
['filesize']))[-1]
29 video_url
= best_format
['url']
31 return {'id': info
['vid'],
32 'title': info
['Subject'],
34 'ext': determine_ext(video_url
),
35 'thumbnail': info
.get('bimg') or info
.get('img'),