TudouIE: implement the parts field in the info_dict
This commit is contained in:
parent
3a6e739da4
commit
1e705ca327
@ -10,7 +10,7 @@ class TudouIE(InfoExtractor):
|
||||
_VALID_URL = r'(?:http://)?(?:www\.)?tudou\.com/(?:listplay|programs|albumplay)/(?:view|(.+?))/(?:([^/]+)|([^/]+))(?:\.html)?'
|
||||
_TESTS = [{
|
||||
u'url': u'http://www.tudou.com/listplay/zzdE77v6Mmo/2xN2duXMxmw.html',
|
||||
u'file': u'159448201.f4v',
|
||||
u'file': u'2xN2duXMxmw.f4v',
|
||||
u'md5': u'140a49ed444bd22f93330985d8475fcb',
|
||||
u'info_dict': {
|
||||
u"title": u"卡马乔国足开大脚长传冲吊集锦"
|
||||
@ -58,21 +58,24 @@ class TudouIE(InfoExtractor):
|
||||
# It looks like the keys are the arguments that have to be passed as
|
||||
# the hd field in the request url, we pick the higher
|
||||
quality = sorted(segments.keys())[-1]
|
||||
parts = segments[quality]
|
||||
result = []
|
||||
len_parts = len(parts)
|
||||
if len_parts > 1:
|
||||
self.to_screen(u'%s: found %s parts' % (video_id, len_parts))
|
||||
for part in parts:
|
||||
segs = segments[quality]
|
||||
parts = []
|
||||
len_segs = len(segs)
|
||||
if len_segs > 1:
|
||||
self.to_screen(u'%s: found %s parts' % (video_id, len_segs))
|
||||
for part in segs:
|
||||
part_id = part['k']
|
||||
final_url = self._url_for_id(part_id, quality)
|
||||
ext = (final_url.split('?')[0]).split('.')[-1]
|
||||
part_info = {'id': part_id,
|
||||
'url': final_url,
|
||||
'ext': ext,
|
||||
'title': title,
|
||||
'thumbnail': thumbnail_url,
|
||||
}
|
||||
result.append(part_info)
|
||||
parts.append(final_url)
|
||||
|
||||
return result
|
||||
info_dict = {'id': video_id,
|
||||
'ext': ext,
|
||||
'title': title,
|
||||
'thumbnail': thumbnail_url,
|
||||
}
|
||||
if len_segs == 1:
|
||||
info_dict['url'] = parts[0]
|
||||
else:
|
||||
info_dict['parts'] = parts
|
||||
return info_dict
|
||||
|
Loading…
x
Reference in New Issue
Block a user