mirror of
https://github.com/soimort/you-get.git
synced 2025-03-13 11:24:02 +03:00
fix pan.baidu
1. change url pattern to support https protocol 2. move print_info and sleep to the entry function. old impl will block for 5 secs with info_only
This commit is contained in:
parent
9c55f93955
commit
f916d837e8
@ -104,9 +104,12 @@ def baidu_download_album(aid, output_dir='.', merge=True, info_only=False):
|
|||||||
|
|
||||||
def baidu_download(url, output_dir='.', stream_type=None, merge=True, info_only=False, **kwargs):
|
def baidu_download(url, output_dir='.', stream_type=None, merge=True, info_only=False, **kwargs):
|
||||||
|
|
||||||
if re.match(r'http://pan.baidu.com', url):
|
if re.match(r'https?://pan.baidu.com', url):
|
||||||
real_url, title, ext, size = baidu_pan_download(url)
|
real_url, title, ext, size = baidu_pan_download(url)
|
||||||
|
print_info('BaiduPan', title, ext, size)
|
||||||
if not info_only:
|
if not info_only:
|
||||||
|
print('Hold on...')
|
||||||
|
time.sleep(5)
|
||||||
download_urls([real_url], title, ext, size,
|
download_urls([real_url], title, ext, size,
|
||||||
output_dir, url, merge=merge, faker=True)
|
output_dir, url, merge=merge, faker=True)
|
||||||
elif re.match(r'http://music.baidu.com/album/\d+', url):
|
elif re.match(r'http://music.baidu.com/album/\d+', url):
|
||||||
@ -209,9 +212,6 @@ def baidu_pan_download(url):
|
|||||||
title_wrapped = json.loads('{"wrapper":"%s"}' % title)
|
title_wrapped = json.loads('{"wrapper":"%s"}' % title)
|
||||||
title = title_wrapped['wrapper']
|
title = title_wrapped['wrapper']
|
||||||
logging.debug(real_url)
|
logging.debug(real_url)
|
||||||
print_info(site_info, title, ext, size)
|
|
||||||
print('Hold on...')
|
|
||||||
time.sleep(5)
|
|
||||||
return real_url, title, ext, size
|
return real_url, title, ext, size
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user