fix: the download url is 403

This commit is contained in:
jiemoon 2016-03-28 10:15:56 +08:00
parent ca2154be5e
commit 44626bb689

View File

@ -5,13 +5,14 @@ __all__ = ['qq_download']
from ..common import * from ..common import *
def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False): def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False):
api = "http://h5vv.video.qq.com/getinfo?otype=json&vid=%s" % vid api = "http://h5vv.video.qq.com/getinfo?platform=11001&otype=json&vid=%s" % vid
content = get_html(api) content = get_html(api)
output_json = json.loads(match1(content, r'QZOutputJson=(.*)')[:-1]) output_json = json.loads(match1(content, r'QZOutputJson=(.*)')[:-1])
url = output_json['vl']['vi'][0]['ul']['ui'][0]['url'] url = output_json['vl']['vi'][0]['ul']['ui'][0]['url']
fvkey = output_json['vl']['vi'][0]['fvkey'] fvkey = output_json['vl']['vi'][0]['fvkey']
lnk = output_json['vl']['vi'][0]['lnk'] fn = output_json['vl']['vi'][0]['fn']
url = '%s/%s.mp4?vkey=%s' % ( url, lnk, fvkey ) url = '%s/%s?vkey=%s' % ( url, fn, fvkey )
print(url)
_, ext, size = url_info(url, faker=True) _, ext, size = url_info(url, faker=True)
print_info(site_info, title, ext, size) print_info(site_info, title, ext, size)