From 17ddd08cd7ed871e044bd330bbca69557c10b6e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AC=9D=E8=87=B4=E9=82=A6?= Date: Thu, 3 Sep 2015 20:03:45 +0000 Subject: [PATCH 1/2] Update cntv.py --- src/you_get/extractors/cntv.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/you_get/extractors/cntv.py b/src/you_get/extractors/cntv.py index 7abd3d41..62bc68ef 100644 --- a/src/you_get/extractors/cntv.py +++ b/src/you_get/extractors/cntv.py @@ -12,9 +12,9 @@ def cntv_download_by_id(id, title = None, output_dir = '.', merge = True, info_o info = json.loads(get_html('http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid=' + id)) title = title or info['title'] video = info['video'] - alternatives = [x for x in video.keys() if x.startswith('chapters')] - #assert alternatives in (['chapters'], ['chapters', 'chapters2']), alternatives - chapters = video['chapters2'] if 'chapters2' in video else video['chapters'] + alternatives = [x for x in video.keys() if x.endswith('hapters')] + #assert alternatives in (['chapters'], ['chapters', 'lowChapters']), alternatives + chapters = video['chapters'] if 'chapters' in video else video['lowChapters'] urls = [x['url'] for x in chapters] ext = r1(r'\.([^.]+)$', urls[0]) assert ext in ('flv', 'mp4') @@ -29,7 +29,7 @@ def cntv_download_by_id(id, title = None, output_dir = '.', merge = True, info_o def cntv_download(url, output_dir = '.', merge = True, info_only = False): if re.match(r'http://\w+\.cntv\.cn/(\w+/\w+/(classpage/video/)?)?\d+/\d+\.shtml', url) or re.match(r'http://\w+.cntv.cn/(\w+/)*VIDE\d+.shtml', url): - id = r1(r'(\w+)', get_html(url)) + id = r1(r'videoCenterId","(\w+)"', get_html(url)) elif re.match(r'http://xiyou.cntv.cn/v-[\w-]+\.html', url): id = r1(r'http://xiyou.cntv.cn/v-([\w-]+)\.html', url) else: From fad5a9b6da90964daadc53f35fd91e5862552f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AC=9D=E8=87=B4=E9=82=A6?= Date: Thu, 3 Sep 2015 20:10:20 +0000 Subject: [PATCH 2/2] Update cntv.py --- src/you_get/extractors/cntv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/you_get/extractors/cntv.py b/src/you_get/extractors/cntv.py index 62bc68ef..fa44545c 100644 --- a/src/you_get/extractors/cntv.py +++ b/src/you_get/extractors/cntv.py @@ -13,7 +13,7 @@ def cntv_download_by_id(id, title = None, output_dir = '.', merge = True, info_o title = title or info['title'] video = info['video'] alternatives = [x for x in video.keys() if x.endswith('hapters')] - #assert alternatives in (['chapters'], ['chapters', 'lowChapters']), alternatives + #assert alternatives in (['chapters'], ['lowChapters', 'chapters'], ['chapters', 'lowChapters']), alternatives chapters = video['chapters'] if 'chapters' in video else video['lowChapters'] urls = [x['url'] for x in chapters] ext = r1(r'\.([^.]+)$', urls[0])