2012-12-01 19:14:04 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
__all__ = ['qq_download']
|
|
|
|
|
|
|
|
from ..common import *
|
|
|
|
|
2015-09-21 00:55:19 +03:00
|
|
|
def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False):
|
|
|
|
api = "http://vv.video.qq.com/geturl?otype=json&vid=%s" % vid
|
|
|
|
content = get_html(api)
|
|
|
|
output_json = json.loads(match1(content, r'QZOutputJson=(.*)')[:-1])
|
|
|
|
url = output_json['vd']['vi'][0]['url']
|
|
|
|
_, ext, size = url_info(url, faker=True)
|
|
|
|
|
|
|
|
print_info(site_info, title, ext, size)
|
2012-12-01 19:14:04 +04:00
|
|
|
if not info_only:
|
2015-09-21 00:55:19 +03:00
|
|
|
download_urls([url], title, ext, size, output_dir=output_dir, merge=merge)
|
2012-12-01 19:14:04 +04:00
|
|
|
|
2015-09-26 08:45:39 +03:00
|
|
|
def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
2015-01-10 10:06:34 +03:00
|
|
|
content = get_html(url)
|
2015-09-21 00:55:19 +03:00
|
|
|
vid = match1(content, r'vid\s*:\s*"\s*([^"]+)"')
|
|
|
|
title = match1(content, r'title\s*:\s*"\s*([^"]+)"')
|
2016-01-23 06:47:08 +03:00
|
|
|
# try to get the right title for URLs like this:
|
|
|
|
# http://v.qq.com/cover/p/ps6mnfqyrfo7es3.html?vid=q0181hpdvo5
|
|
|
|
title = matchall(content, [r'title\s*:\s*"\s*([^"]+)"'])[-1]
|
2015-09-21 00:55:19 +03:00
|
|
|
|
2015-01-10 10:06:34 +03:00
|
|
|
qq_download_by_vid(vid, title, output_dir, merge, info_only)
|
2012-12-01 19:14:04 +04:00
|
|
|
|
2013-01-11 07:43:30 +04:00
|
|
|
site_info = "QQ.com"
|
2012-12-01 19:14:04 +04:00
|
|
|
download = qq_download
|
|
|
|
download_playlist = playlist_not_supported('qq')
|