mirror of
https://github.com/soimort/you-get.git
synced 2025-02-11 20:52:31 +03:00
Merge branch 'develop' of https://github.com/soimort/you-get into develop
This commit is contained in:
commit
69a54bfd2c
@ -73,7 +73,14 @@ def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False):
|
||||
def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
||||
""""""
|
||||
if 'live.qq.com' in url:
|
||||
qieDownload(url,output_dir=output_dir, merge=merge, info_only=info_only)
|
||||
qieDownload(url, output_dir=output_dir, merge=merge, info_only=info_only)
|
||||
return
|
||||
|
||||
if 'mp.weixin.qq.com/s?' in url:
|
||||
content = get_html(url)
|
||||
vids = matchall(content, [r'\bvid=(\w+)'])
|
||||
for vid in vids:
|
||||
qq_download_by_vid(vid, vid, output_dir, merge, info_only)
|
||||
return
|
||||
|
||||
#do redirect
|
||||
@ -101,8 +108,6 @@ def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
||||
title = match1(content, r'"title":"([^"]+)"') if not title else title
|
||||
title = vid if not title else title #general fallback
|
||||
|
||||
|
||||
|
||||
qq_download_by_vid(vid, title, output_dir, merge, info_only)
|
||||
|
||||
site_info = "QQ.com"
|
||||
|
@ -143,9 +143,9 @@ class Youku(VideoExtractor):
|
||||
})
|
||||
else:
|
||||
proxy_handler = request.ProxyHandler({})
|
||||
opener = request.build_opener(ssl_context, cookie_handler, proxy_handler)
|
||||
opener.addheaders = [('Cookie','__ysuid={}'.format(time.time()))]
|
||||
request.install_opener(opener)
|
||||
for handler in (ssl_context, cookie_handler, proxy_handler):
|
||||
request._opener.add_handler(handler)
|
||||
request._opener.addheaders = [('Cookie','__ysuid={}'.format(time.time()))]
|
||||
|
||||
assert self.url or self.vid
|
||||
|
||||
@ -162,7 +162,7 @@ class Youku(VideoExtractor):
|
||||
api12_url = kwargs['api12_url'] #86
|
||||
self.ctype = kwargs['ctype']
|
||||
self.title = kwargs['title']
|
||||
|
||||
|
||||
else:
|
||||
api_url = 'http://play.youku.com/play/get.json?vid=%s&ct=10' % self.vid
|
||||
api12_url = 'http://play.youku.com/play/get.json?vid=%s&ct=12' % self.vid
|
||||
@ -330,36 +330,36 @@ class Youku(VideoExtractor):
|
||||
|
||||
def open_download_by_vid(self, client_id, vid, **kwargs):
|
||||
"""self, str, str, **kwargs->None
|
||||
|
||||
|
||||
Arguments:
|
||||
client_id: An ID per client. For now we only know Acfun's
|
||||
such ID.
|
||||
|
||||
|
||||
vid: An video ID for each video, starts with "C".
|
||||
|
||||
|
||||
kwargs['embsig']: Youku COOP's anti hotlinking.
|
||||
For Acfun, an API call must be done to Acfun's
|
||||
server, or the "playsign" of the content of sign_url
|
||||
shall be empty.
|
||||
|
||||
|
||||
Misc:
|
||||
Override the original one with VideoExtractor.
|
||||
|
||||
|
||||
Author:
|
||||
Most of the credit are to @ERioK, who gave his POC.
|
||||
|
||||
|
||||
History:
|
||||
Jul.28.2016 Youku COOP now have anti hotlinking via embsig. """
|
||||
self.f_code_1 = '10ehfkbv' #can be retrived by running r.translate with the keys and the list e
|
||||
self.f_code_2 = 'msjv7h2b'
|
||||
|
||||
|
||||
# as in VideoExtractor
|
||||
self.url = None
|
||||
self.vid = vid
|
||||
self.name = "优酷开放平台 (Youku COOP)"
|
||||
|
||||
#A little bit of work before self.prepare
|
||||
|
||||
|
||||
#Change as Jul.28.2016 Youku COOP updates its platform to add ant hotlinking
|
||||
if kwargs['embsig']:
|
||||
sign_url = "https://api.youku.com/players/custom.json?client_id={client_id}&video_id={video_id}&embsig={embsig}".format(client_id = client_id, video_id = vid, embsig = kwargs['embsig'])
|
||||
@ -371,9 +371,9 @@ class Youku(VideoExtractor):
|
||||
#to be injected and replace ct10 and 12
|
||||
api85_url = 'http://play.youku.com/partner/get.json?cid={client_id}&vid={vid}&ct=85&sign={playsign}'.format(client_id = client_id, vid = vid, playsign = playsign)
|
||||
api86_url = 'http://play.youku.com/partner/get.json?cid={client_id}&vid={vid}&ct=86&sign={playsign}'.format(client_id = client_id, vid = vid, playsign = playsign)
|
||||
|
||||
|
||||
self.prepare(api_url = api85_url, api12_url = api86_url, ctype = 86, **kwargs)
|
||||
|
||||
|
||||
#exact copy from original VideoExtractor
|
||||
if 'extractor_proxy' in kwargs and kwargs['extractor_proxy']:
|
||||
unset_proxy()
|
||||
|
Loading…
Reference in New Issue
Block a user