mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 08:43:58 +03:00
support view.inews.qq.com/a/20180521V0Z9MH00 https://kuaibao.qq.com/s/20180521V0Z9MH00 https://v.qq.com/x/cover/t0fqsm1y83r8v5j/a0026nvw5jr.html
This commit is contained in:
parent
80aa34f538
commit
feffd883ea
@ -2,28 +2,25 @@
|
|||||||
|
|
||||||
__all__ = ['qq_download']
|
__all__ = ['qq_download']
|
||||||
|
|
||||||
from ..common import *
|
|
||||||
from ..util.log import *
|
|
||||||
from .qie import download as qieDownload
|
from .qie import download as qieDownload
|
||||||
from .qie_video import download_by_url as qie_video_download
|
from .qie_video import download_by_url as qie_video_download
|
||||||
from urllib.parse import urlparse,parse_qs
|
from ..common import *
|
||||||
|
|
||||||
def qq_download_by_vid(vid, title, default_from, output_dir='.', merge=True, info_only=False):
|
|
||||||
|
|
||||||
if default_from:
|
def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False):
|
||||||
platform = 11
|
|
||||||
else:
|
|
||||||
# fix return {,"msg":"cannot play outside"}
|
|
||||||
platform = 4100201
|
|
||||||
|
|
||||||
info_api = 'http://vv.video.qq.com/getinfo?otype=json&appver=3.2.19.333&platform=11&defnpayver=1&defn=shd&vid={}'.format(vid)
|
# http://v.sports.qq.com/#/cover/t0fqsm1y83r8v5j/a0026nvw5jr https://v.qq.com/x/cover/t0fqsm1y83r8v5j/a0026nvw5jr.html
|
||||||
|
video_json = None
|
||||||
|
platforms = [4100201, 11]
|
||||||
|
for platform in platforms:
|
||||||
|
info_api = 'http://vv.video.qq.com/getinfo?otype=json&appver=3.2.19.333&platform={}&defnpayver=1&defn=shd&vid={}'.format(platform, vid)
|
||||||
info = get_content(info_api)
|
info = get_content(info_api)
|
||||||
video_json = json.loads(match1(info, r'QZOutputJson=(.*)')[:-1])
|
video_json = json.loads(match1(info, r'QZOutputJson=(.*)')[:-1])
|
||||||
|
if not video_json.get('msg')=='cannot play outside':
|
||||||
|
break
|
||||||
fn_pre = video_json['vl']['vi'][0]['lnk']
|
fn_pre = video_json['vl']['vi'][0]['lnk']
|
||||||
title = video_json['vl']['vi'][0]['ti']
|
title = video_json['vl']['vi'][0]['ti']
|
||||||
host = video_json['vl']['vi'][0]['ul']['ui'][0]['url']
|
host = video_json['vl']['vi'][0]['ul']['ui'][0]['url']
|
||||||
streams = video_json['fl']['fi']
|
|
||||||
seg_cnt = fc_cnt = video_json['vl']['vi'][0]['cl']['fc']
|
seg_cnt = fc_cnt = video_json['vl']['vi'][0]['cl']['fc']
|
||||||
|
|
||||||
filename = video_json['vl']['vi'][0]['fn']
|
filename = video_json['vl']['vi'][0]['fn']
|
||||||
@ -32,8 +29,6 @@ def qq_download_by_vid(vid, title, default_from, output_dir='.', merge=True, inf
|
|||||||
else:
|
else:
|
||||||
fn_pre, magic_str, video_type = filename.split('.')
|
fn_pre, magic_str, video_type = filename.split('.')
|
||||||
|
|
||||||
best_quality = streams[-1]['name']
|
|
||||||
|
|
||||||
part_urls= []
|
part_urls= []
|
||||||
total_size = 0
|
total_size = 0
|
||||||
for part in range(1, seg_cnt+1):
|
for part in range(1, seg_cnt+1):
|
||||||
@ -112,7 +107,6 @@ def kg_qq_download_by_shareid(shareid, output_dir='.', info_only=False, caption=
|
|||||||
|
|
||||||
def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
||||||
""""""
|
""""""
|
||||||
default_from = True
|
|
||||||
|
|
||||||
if re.match(r'https?://egame.qq.com/live\?anchorid=(\d+)', url):
|
if re.match(r'https?://egame.qq.com/live\?anchorid=(\d+)', url):
|
||||||
from . import qq_egame
|
from . import qq_egame
|
||||||
@ -136,10 +130,18 @@ def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
|||||||
content = get_content(url)
|
content = get_content(url)
|
||||||
vids = matchall(content, [r'\?vid=(\w+)'])
|
vids = matchall(content, [r'\?vid=(\w+)'])
|
||||||
for vid in vids:
|
for vid in vids:
|
||||||
qq_download_by_vid(vid, vid, default_from, output_dir, merge, info_only)
|
qq_download_by_vid(vid, vid, output_dir, merge, info_only)
|
||||||
return
|
return
|
||||||
|
|
||||||
if 'kuaibao.qq.com' in url or re.match(r'http://daxue.qq.com/content/content/id/\d+', url):
|
if 'kuaibao.qq.com/s/' in url:
|
||||||
|
# https://kuaibao.qq.com/s/20180521V0Z9MH00
|
||||||
|
nid = match1(url, r'/s/([^/&?#]+)')
|
||||||
|
content = get_content('https://kuaibao.qq.com/getVideoRelate?id=' + nid)
|
||||||
|
info_json = json.loads(content)
|
||||||
|
vid=info_json['videoinfo']['vid']
|
||||||
|
title=info_json['videoinfo']['title']
|
||||||
|
elif 'kuaibao.qq.com' in url or re.match(r'http://daxue.qq.com/content/content/id/\d+', url):
|
||||||
|
# http://daxue.qq.com/content/content/id/2321
|
||||||
content = get_content(url)
|
content = get_content(url)
|
||||||
vid = match1(content, r'vid\s*=\s*"\s*([^"]+)"')
|
vid = match1(content, r'vid\s*=\s*"\s*([^"]+)"')
|
||||||
title = match1(content, r'title">([^"]+)</p>')
|
title = match1(content, r'title">([^"]+)</p>')
|
||||||
@ -148,6 +150,11 @@ def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
|||||||
vid = match1(url, r'\bvid=(\w+)')
|
vid = match1(url, r'\bvid=(\w+)')
|
||||||
# for embedded URLs; don't know what the title is
|
# for embedded URLs; don't know what the title is
|
||||||
title = vid
|
title = vid
|
||||||
|
elif 'view.inews.qq.com' in url:
|
||||||
|
# view.inews.qq.com/a/20180521V0Z9MH00
|
||||||
|
content = get_content(url)
|
||||||
|
vid = match1(content, r'"vid":"(\w+)"')
|
||||||
|
title = match1(content, r'"title":"(\w+)"')
|
||||||
else:
|
else:
|
||||||
content = get_content(url)
|
content = get_content(url)
|
||||||
#vid = parse_qs(urlparse(url).query).get('vid') #for links specified vid like http://v.qq.com/cover/p/ps6mnfqyrfo7es3.html?vid=q0181hpdvo5
|
#vid = parse_qs(urlparse(url).query).get('vid') #for links specified vid like http://v.qq.com/cover/p/ps6mnfqyrfo7es3.html?vid=q0181hpdvo5
|
||||||
@ -167,12 +174,8 @@ def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
|||||||
title = match1(content, r'"title":"([^"]+)"') if not title else title
|
title = match1(content, r'"title":"([^"]+)"') if not title else title
|
||||||
title = vid if not title else title #general fallback
|
title = vid if not title else title #general fallback
|
||||||
|
|
||||||
if 'v.sports.qq.com' in url:
|
|
||||||
# fix url forbidden
|
|
||||||
# example:http://v.sports.qq.com/#/cover/t0fqsm1y83r8v5j/a0026nvw5jr
|
|
||||||
default_from = False
|
|
||||||
|
|
||||||
qq_download_by_vid(vid, title, default_from, output_dir, merge, info_only)
|
qq_download_by_vid(vid, title, output_dir, merge, info_only)
|
||||||
|
|
||||||
site_info = "QQ.com"
|
site_info = "QQ.com"
|
||||||
download = qq_download
|
download = qq_download
|
||||||
|
Loading…
Reference in New Issue
Block a user