]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/c56.py
4c8a8af0917ba4d26e213ad01e6ed148d7a79e42
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.mp4',
16 u
'md5': u
'9dc07b5c8e978112a6441f9e75d2b59e',
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'),