From 1f2c0bde94f9b78907952c59453694785153a736 Mon Sep 17 00:00:00 2001 From: Zhang Ning Date: Fri, 22 Jan 2016 17:58:35 +0800 Subject: [PATCH 1/2] Revert "fix zhanqitv" This reverts commit eaab0ce3ed3054db0a12bad5e8511d5e7791f5c8. Signed-off-by: Zhang Ning --- src/you_get/extractors/zhanqi.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/you_get/extractors/zhanqi.py b/src/you_get/extractors/zhanqi.py index 7d6b75b6..a648bc4a 100644 --- a/src/you_get/extractors/zhanqi.py +++ b/src/you_get/extractors/zhanqi.py @@ -4,10 +4,6 @@ __all__ = ['zhanqi_download'] from ..common import * import re -import base64 -import json -import time -import hashlib def zhanqi_download(url, output_dir = '.', merge = True, info_only = False, **kwargs): html = get_content(url) @@ -24,28 +20,12 @@ def zhanqi_download(url, output_dir = '.', merge = True, info_only = False, **kw rtmp_base = "http://wshdl.load.cdn.zhanqi.tv/zqlive" vod_base = "http://dlvod.cdn.zhanqi.tv" rtmp_real_base = "rtmp://dlrtmp.cdn.zhanqi.tv/zqlive/" - room_info = "http://www.zhanqi.tv/api/static/live.roomid/" - KEY_MASK = "#{&..?!(" - ak2_pattern = r'ak2":"\d-([^|]+)' if video_type == "LIVE": rtmp_id = match1(html, rtmp_id_patt).replace('\\/','/') #request_url = rtmp_base+'/'+rtmp_id+'.flv?get_url=1' #real_url = get_html(request_url) - html2 = get_content(room_info + rtmp_id.split("_")[0] + ".json") - json_data = json.loads(html2) - cdns = json_data["data"]["flashvars"]["cdns"] - cdns = base64.b64decode(cdns).decode("utf-8") - cdn = match1(cdns, ak2_pattern) - cdn = base64.b64decode(cdn).decode("utf-8") - key = '' - i = 0 - while(i < len(cdn)): - key = key + chr(ord(cdn[i]) ^ ord(KEY_MASK[i % 8])) - i = i + 1 - time_hex = hex(int(time.time()))[2:] - key = hashlib.md5(bytes(key + "/zqlive/" + rtmp_id + time_hex, "utf-8")).hexdigest() - real_url = rtmp_real_base + '/' + rtmp_id + "?k=" + key + "&t=" + time_hex + real_url = rtmp_real_base + '/' + rtmp_id print_info(site_info, title, 'flv', float('inf')) if not info_only: download_rtmp_url(real_url, title, 'flv', {}, output_dir, merge = merge) From 75d8367ade90814a0da3414df5a80c42a2803237 Mon Sep 17 00:00:00 2001 From: Zhang Ning Date: Fri, 22 Jan 2016 17:59:09 +0800 Subject: [PATCH 2/2] Revert "[ZhanQi]temporary fix using RTMP url" This reverts commit 953c2547bcd60204895974f85ba28a5898443ee6. Signed-off-by: Zhang Ning --- src/you_get/extractors/zhanqi.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/you_get/extractors/zhanqi.py b/src/you_get/extractors/zhanqi.py index a648bc4a..f450f954 100644 --- a/src/you_get/extractors/zhanqi.py +++ b/src/you_get/extractors/zhanqi.py @@ -19,17 +19,15 @@ def zhanqi_download(url, output_dir = '.', merge = True, info_only = False, **kw title = unescape_html(title) rtmp_base = "http://wshdl.load.cdn.zhanqi.tv/zqlive" vod_base = "http://dlvod.cdn.zhanqi.tv" - rtmp_real_base = "rtmp://dlrtmp.cdn.zhanqi.tv/zqlive/" if video_type == "LIVE": rtmp_id = match1(html, rtmp_id_patt).replace('\\/','/') - #request_url = rtmp_base+'/'+rtmp_id+'.flv?get_url=1' - #real_url = get_html(request_url) - real_url = rtmp_real_base + '/' + rtmp_id + request_url = rtmp_base+'/'+rtmp_id+'.flv?get_url=1' + real_url = get_html(request_url) print_info(site_info, title, 'flv', float('inf')) if not info_only: - download_rtmp_url(real_url, title, 'flv', {}, output_dir, merge = merge) - #download_urls([real_url], title, 'flv', None, output_dir, merge = merge) + #download_rtmp_url(real_url, title, 'flv', {}, output_dir, merge = merge) + download_urls([real_url], title, 'flv', None, output_dir, merge = merge) elif video_type == "VOD": vod_m3u8_request = vod_base + match1(html, vod_m3u8_id_patt).replace('\\/','/') vod_m3u8 = get_html(vod_m3u8_request) @@ -49,7 +47,6 @@ def zhanqi_download(url, output_dir = '.', merge = True, info_only = False, **kw download_urls(real_url, title, type_ or 'ts', size, output_dir, merge = merge) else: NotImplementedError('Unknown_video_type') - site_info = "zhanqi.tv" download = zhanqi_download download_playlist = playlist_not_supported('zhanqi')