From cc54abb7e3a1394133cf4b12c162384613edecc6 Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan <yan12125@gmail.com> Date: Wed, 11 Dec 2013 15:12:32 +0800 Subject: [PATCH] Fix 2 bugs in youtube_dl/extractor/sohu.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- youtube_dl/extractor/sohu.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/sohu.py b/youtube_dl/extractor/sohu.py index 2b9bf0cb7..f37724650 100644 --- a/youtube_dl/extractor/sohu.py +++ b/youtube_dl/extractor/sohu.py @@ -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),