mirror of
https://github.com/soimort/you-get.git
synced 2025-02-11 04:32:27 +03:00
resolve conflict
This commit is contained in:
commit
091857613f
@ -165,9 +165,16 @@ class Bilibili(VideoExtractor):
|
|||||||
qq_download_by_vid(tc_flashvars, self.title, output_dir=kwargs['output_dir'], merge=kwargs['merge'], info_only=kwargs['info_only'])
|
qq_download_by_vid(tc_flashvars, self.title, output_dir=kwargs['output_dir'], merge=kwargs['merge'], info_only=kwargs['info_only'])
|
||||||
return
|
return
|
||||||
|
|
||||||
cid = re.search(r'cid=(\d+)', self.page).group(1)
|
has_plist = re.search(r'<option', self.page)
|
||||||
|
if has_plist and r1('index_(\d+).html', self.url) is None:
|
||||||
|
log.w('This page contains a playlist. (use --playlist to download all videos.)')
|
||||||
|
|
||||||
|
try:
|
||||||
|
cid = re.search(r'cid=(\d+)', self.page).group(1)
|
||||||
|
except:
|
||||||
|
cid = re.search(r'"cid":(\d+)', self.page).group(1)
|
||||||
if cid is not None:
|
if cid is not None:
|
||||||
self.download_by_vid(cid, False, **kwargs)
|
self.download_by_vid(cid, re.search('bangumi', self.url) is not None, **kwargs)
|
||||||
else:
|
else:
|
||||||
# flashvars?
|
# flashvars?
|
||||||
flashvars = re.search(r'flashvars="([^"]+)"', self.page).group(1)
|
flashvars = re.search(r'flashvars="([^"]+)"', self.page).group(1)
|
||||||
|
@ -65,9 +65,6 @@ def video_info(vid,**kwargs):
|
|||||||
if "stream_id" in kwargs and kwargs["stream_id"].lower() in support_stream_id:
|
if "stream_id" in kwargs and kwargs["stream_id"].lower() in support_stream_id:
|
||||||
stream_id = kwargs["stream_id"]
|
stream_id = kwargs["stream_id"]
|
||||||
else:
|
else:
|
||||||
print("Current Video Supports:")
|
|
||||||
for i in support_stream_id:
|
|
||||||
print("\t--format",i,"<URL>")
|
|
||||||
if "1080p" in support_stream_id:
|
if "1080p" in support_stream_id:
|
||||||
stream_id = '1080p'
|
stream_id = '1080p'
|
||||||
elif "720p" in support_stream_id:
|
elif "720p" in support_stream_id:
|
||||||
|
@ -36,13 +36,18 @@ def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False):
|
|||||||
part_info = get_content(key_api)
|
part_info = get_content(key_api)
|
||||||
key_json = json.loads(match1(part_info, r'QZOutputJson=(.*)')[:-1])
|
key_json = json.loads(match1(part_info, r'QZOutputJson=(.*)')[:-1])
|
||||||
if key_json.get('key') is None:
|
if key_json.get('key') is None:
|
||||||
|
vkey = video_json['vl']['vi'][0]['fvkey']
|
||||||
|
url = '{}{}?vkey={}'.format(video_json['vl']['vi'][0]['ul']['ui'][0]['url'], fn_pre + '.mp4', vkey)
|
||||||
|
else:
|
||||||
|
vkey = key_json['key']
|
||||||
|
url = '{}{}?vkey={}'.format(host, filename, vkey)
|
||||||
|
if not vkey:
|
||||||
if part == 1:
|
if part == 1:
|
||||||
log.wtf(key_json['msg'])
|
log.wtf(key_json['msg'])
|
||||||
else:
|
else:
|
||||||
log.w(key_json['msg'])
|
log.w(key_json['msg'])
|
||||||
break
|
break
|
||||||
vkey = key_json['key']
|
|
||||||
url = '{}{}?vkey={}'.format(host, filename, vkey)
|
|
||||||
part_urls.append(url)
|
part_urls.append(url)
|
||||||
_, ext, size = url_info(url)
|
_, ext, size = url_info(url)
|
||||||
total_size += size
|
total_size += size
|
||||||
@ -140,9 +145,13 @@ def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
|||||||
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
|
||||||
vid = url.split('/')[-1].split('.')[0] #https://v.qq.com/x/cover/ps6mnfqyrfo7es3/q0181hpdvo5.html?
|
rurl = match1(content, r'<link.*?rel\s*=\s*"canonical".*?href\s*="(.+?)".*?>') #https://v.qq.com/x/cover/9hpjiv5fhiyn86u/t0522x58xma.html
|
||||||
|
vid = ""
|
||||||
|
if rurl:
|
||||||
|
vid = rurl.split('/')[-1].split('.')[0]
|
||||||
|
vid = vid if vid else url.split('/')[-1].split('.')[0] #https://v.qq.com/x/cover/ps6mnfqyrfo7es3/q0181hpdvo5.html?
|
||||||
vid = vid if vid else match1(content, r'vid"*\s*:\s*"\s*([^"]+)"') #general fallback
|
vid = vid if vid else match1(content, r'vid"*\s*:\s*"\s*([^"]+)"') #general fallback
|
||||||
if vid is None:
|
if not vid:
|
||||||
vid = match1(content, r'id"*\s*:\s*"(.+?)"')
|
vid = match1(content, r'id"*\s*:\s*"(.+?)"')
|
||||||
title = match1(content,r'<a.*?id\s*=\s*"%s".*?title\s*=\s*"(.+?)".*?>'%vid)
|
title = match1(content,r'<a.*?id\s*=\s*"%s".*?title\s*=\s*"(.+?)".*?>'%vid)
|
||||||
title = match1(content, r'title">([^"]+)</p>') if not title else title
|
title = match1(content, r'title">([^"]+)</p>') if not title else title
|
||||||
|
@ -78,7 +78,7 @@ class Youku(VideoExtractor):
|
|||||||
self.api_error_code = None
|
self.api_error_code = None
|
||||||
self.api_error_msg = None
|
self.api_error_msg = None
|
||||||
|
|
||||||
self.ccode = '0508'
|
self.ccode = '0512'
|
||||||
self.utid = None
|
self.utid = None
|
||||||
|
|
||||||
def youku_ups(self):
|
def youku_ups(self):
|
||||||
@ -154,7 +154,7 @@ class Youku(VideoExtractor):
|
|||||||
log.wtf('Cannot fetch vid')
|
log.wtf('Cannot fetch vid')
|
||||||
|
|
||||||
if kwargs.get('src') and kwargs['src'] == 'tudou':
|
if kwargs.get('src') and kwargs['src'] == 'tudou':
|
||||||
self.ccode = '0501'
|
self.ccode = '0512'
|
||||||
|
|
||||||
if kwargs.get('password') and kwargs['password']:
|
if kwargs.get('password') and kwargs['password']:
|
||||||
self.password_protected = True
|
self.password_protected = True
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
script_name = 'you-get'
|
script_name = 'you-get'
|
||||||
__version__ = '0.4.995'
|
__version__ = '0.4.1011'
|
||||||
|
@ -48,18 +48,11 @@ class YouGetTests(unittest.TestCase):
|
|||||||
'https://www.bilibili.com/video/av13228063/', info_only=True
|
'https://www.bilibili.com/video/av13228063/', info_only=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_douyin(self):
|
|
||||||
douyin.download(
|
|
||||||
'https://www.douyin.com/share/video/6492273288897629454',
|
|
||||||
info_only=True
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_netease(self):
|
def test_netease(self):
|
||||||
netease.download(
|
netease.download(
|
||||||
'http://v.ent.163.com/video/2017/12/9/V/VD5BG8P9V.html',
|
'http://v.ent.163.com/video/2017/12/9/V/VD5BG8P9V.html',
|
||||||
info_only=True
|
info_only=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user