]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/yinyuetai.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   5 from ..utils 
import ExtractorError
 
   8 class YinYueTaiIE(InfoExtractor
): 
   9     IE_NAME 
= 'yinyuetai:video' 
  11     _VALID_URL 
= r
'https?://v\.yinyuetai\.com/video(?:/h5)?/(?P<id>[0-9]+)' 
  13         'url': 'http://v.yinyuetai.com/video/2322376', 
  14         'md5': '6e3abe28d38e3a54b591f9f040595ce0', 
  18             'title': '少女时代_PARTY_Music Video Teaser', 
  21             'thumbnail': 're:^https?://.*\.jpg$', 
  24         'url': 'http://v.yinyuetai.com/video/h5/2322376', 
  25         'only_matching': True, 
  28     def _real_extract(self
, url
): 
  29         video_id 
= self
._match
_id
(url
) 
  31         info 
= self
._download
_json
( 
  32             'http://ext.yinyuetai.com/main/get-h-mv-info?json=true&videoId=%s' % video_id
, video_id
, 
  33             'Downloading mv info')['videoInfo']['coreVideoInfo'] 
  36             raise ExtractorError(info
['errorMsg'], expected
=True) 
  39             'url': format_info
['videoUrl'], 
  40             'format_id': format_info
['qualityLevel'], 
  41             'format': format_info
.get('qualityLevelName'), 
  42             'filesize': format_info
.get('fileSize'), 
  43             # though URLs ends with .flv, the downloaded files are in fact mp4 
  45             'tbr': format_info
.get('bitrate'), 
  46         } for format_info 
in info
['videoUrlModels']] 
  47         self
._sort
_formats
(formats
) 
  51             'title': info
['videoName'], 
  52             'thumbnail': info
.get('bigHeadImage'), 
  53             'creator': info
.get('artistNames'), 
  54             'duration': info
.get('duration'),