1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-14 06:37:17 +08:00

Fix 2 bugs in youtube_dl/extractor/sohu.py

1. Highest quality is the first one in ('ori', 'super', 'high', 'nor')
   Their chinese names are 原画, 超清, 高清, 标清, respectively
2. Sohu's server can't identify duplicate slashes in the url.
This commit is contained in:
Yen Chi Hsuan 2013-12-11 15:12:32 +08:00
parent 1825836235
commit cc54abb7e3

View File

@ -53,7 +53,7 @@ class SohuIE(InfoExtractor):
raise ExtractorError(u'No formats available for this video')
# For now, we just pick the highest available quality
vid_id = vid_ids[-1]
vid_id = vid_ids[0]
format_data = data if vid == vid_id else _fetch_data(vid_id, mytv)
part_count = format_data['data']['totalBlocks']
@ -71,7 +71,10 @@ class SohuIE(InfoExtractor):
note=u'Downloading part %d of %d' % (i+1, part_count))
part_info = part_str.split('|')
video_url = '%s%s?key=%s' % (part_info[0], su[i], part_info[3])
if part_info[0][-1] == '/' and su[i][0] == '/':
video_url = '%s%s?key=%s' % (part_info[0], su[i][1:], part_info[3])
else:
video_url = '%s%s?key=%s' % (part_info[0], su[i], part_info[3])
video_info = {
'id': '%s_part%02d' % (video_id, i + 1),