0
0
Fork 0

[yinyuetai] Miscellaneous improvements

1. Include all fields in _TEST
2. Use .get() for optional fields
3. Clarify the intention of 'ext' in formats
main
Yen Chi Hsuan 2015-07-09 01:07:45 +08:00
parent af0f9b0e95
commit d76dea001b
1 changed files with 9 additions and 6 deletions

View File

@ -16,6 +16,8 @@ class YinYueTaiIE(InfoExtractor):
'ext': 'mp4', 'ext': 'mp4',
'title': '少女时代_PARTY_Music Video Teaser', 'title': '少女时代_PARTY_Music Video Teaser',
'creator': '少女时代', 'creator': '少女时代',
'duration': 25,
'thumbnail': 're:^https?://.*\.jpg$',
}, },
}, { }, {
'url': 'http://v.yinyuetai.com/video/h5/2322376', 'url': 'http://v.yinyuetai.com/video/h5/2322376',
@ -35,18 +37,19 @@ class YinYueTaiIE(InfoExtractor):
formats = [{ formats = [{
'url': format_info['videoUrl'], 'url': format_info['videoUrl'],
'format_id': format_info['qualityLevel'], 'format_id': format_info['qualityLevel'],
'format': format_info['qualityLevelName'], 'format': format_info.get('qualityLevelName'),
'filesize': format_info['fileSize'], 'filesize': format_info.get('fileSize'),
# though URLs ends with .flv, the downloaded files are in fact mp4
'ext': 'mp4', 'ext': 'mp4',
'preference': format_info['bitrate'], 'tbr': format_info.get('bitrate'),
} for format_info in info['videoUrlModels']] } for format_info in info['videoUrlModels']]
self._sort_formats(formats) self._sort_formats(formats)
return { return {
'id': video_id, 'id': video_id,
'title': info['videoName'], 'title': info['videoName'],
'thumbnail': info['bigHeadImage'], 'thumbnail': info.get('bigHeadImage'),
'creator': info['artistNames'], 'creator': info.get('artistNames'),
'duration': info['duration'], 'duration': info.get('duration'),
'formats': formats, 'formats': formats,
} }