From cc54abb7e3a1394133cf4b12c162384613edecc6 Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Wed, 11 Dec 2013 15:12:32 +0800 Subject: [PATCH 1/3] 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), From 9431b9eddd6acb3e79862cd7a88472cb7c1e29ba Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Thu, 19 Dec 2013 02:50:40 +0800 Subject: [PATCH 2/3] [Sohu] Update the MD5 checksum of the test case --- youtube_dl/extractor/sohu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/sohu.py b/youtube_dl/extractor/sohu.py index f37724650..2669fe7cf 100644 --- a/youtube_dl/extractor/sohu.py +++ b/youtube_dl/extractor/sohu.py @@ -13,7 +13,7 @@ class SohuIE(InfoExtractor): _TEST = { u'url': u'http://tv.sohu.com/20130724/n382479172.shtml#super', u'file': u'382479172.mp4', - u'md5': u'bde8d9a6ffd82c63a1eefaef4eeefec7', + u'md5': u'cc84eed6b6fbf0f2f9a8d3cb9da1939b', u'info_dict': { u'title': u'MV:Far East Movement《The Illest》', }, From f381f04616d6cb0afdaa9ccdea5dab3794551763 Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Thu, 19 Dec 2013 20:42:50 +0800 Subject: [PATCH 3/3] [Sohu] Fix a test failure due to md5 errors Only the first 10240 bytes are calculated in tests --- youtube_dl/extractor/sohu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/sohu.py b/youtube_dl/extractor/sohu.py index 2669fe7cf..44d607f67 100644 --- a/youtube_dl/extractor/sohu.py +++ b/youtube_dl/extractor/sohu.py @@ -13,7 +13,7 @@ class SohuIE(InfoExtractor): _TEST = { u'url': u'http://tv.sohu.com/20130724/n382479172.shtml#super', u'file': u'382479172.mp4', - u'md5': u'cc84eed6b6fbf0f2f9a8d3cb9da1939b', + u'md5': u'29175c8cadd8b5cc4055001e85d6b372', u'info_dict': { u'title': u'MV:Far East Movement《The Illest》', },