[CNTV] Fix CCAV domain, Add pattern, fix #1193 ,#909 , replace #1031

This commit is contained in:
David Zhuang 2016-06-30 02:36:07 -04:00
parent 7c2ea4f641
commit 62a9e35ed0
2 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,7 @@ SITES = {
'bandcamp' : 'bandcamp', 'bandcamp' : 'bandcamp',
'baomihua' : 'baomihua', 'baomihua' : 'baomihua',
'bilibili' : 'bilibili', 'bilibili' : 'bilibili',
'cctv' : 'cntv',
'cntv' : 'cntv', 'cntv' : 'cntv',
'cbs' : 'cbs', 'cbs' : 'cbs',
'dailymotion' : 'dailymotion', 'dailymotion' : 'dailymotion',

View File

@ -7,6 +7,7 @@ from ..common import *
import json import json
import re import re
def cntv_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False): def cntv_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
assert id assert id
info = json.loads(get_html('http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid=' + id)) info = json.loads(get_html('http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid=' + id))
@ -31,7 +32,12 @@ 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, **kwargs): def cntv_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
if re.match(r'http://tv\.cntv\.cn/video/(\w+)/(\w+)', url): if re.match(r'http://tv\.cntv\.cn/video/(\w+)/(\w+)', url):
id = match1(url, r'http://tv\.cntv\.cn/video/\w+/(\w+)') id = match1(url, r'http://tv\.cntv\.cn/video/\w+/(\w+)')
elif 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): elif re.match(r'http://\w+.cctv.com/\d+/\d+/\d+/\w+.shtml', url) or re.match(r'http://\w+.cntv.cn/\d+/\d+/\d+/\w+.shtml', url):
html = get_content(url)
id = match1(html, r'guid = \"(.+)\"')
elif 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) or \
re.match(r'http://(\w+).cntv.cn/(\w+)/classpage/video/(\d+)/(\d+).shtml', url):
id = r1(r'videoCenterId","(\w+)"', get_html(url)) id = r1(r'videoCenterId","(\w+)"', get_html(url))
elif re.match(r'http://xiyou.cntv.cn/v-[\w-]+\.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) id = r1(r'http://xiyou.cntv.cn/v-([\w-]+)\.html', url)