]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/c56.py
   2 from __future__ 
import unicode_literals
 
   7 from .common 
import InfoExtractor
 
  10 class C56IE(InfoExtractor
): 
  11     _VALID_URL 
= r
'https?://((www|player)\.)?56\.com/(.+?/)?(v_|(play_album.+-))(?P<textid>.+?)\.(html|swf)' 
  14         'url': 'http://www.56.com/u39/v_OTM0NDA3MTY.html', 
  15         'file': '93440716.flv', 
  16         'md5': 'e59995ac63d0457783ea05f93f12a866', 
  18             'title': '网事知多少 第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
, 'Downloading video info') 
  27         info 
= json
.loads(info_page
)['info'] 
  29             'format_id': f
['type'], 
  30             'filesize': int(f
['filesize']), 
  32         } for f 
in info
['rfiles']] 
  33         self
._sort
_formats
(formats
) 
  37             'title': info
['Subject'], 
  39             'thumbnail': info
.get('bimg') or info
.get('img'),