From f916d837e8d027257be05e145257519686aa383c Mon Sep 17 00:00:00 2001 From: MaxwellGoblin Date: Sat, 9 Sep 2017 09:28:38 +0800 Subject: [PATCH] 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 --- src/you_get/extractors/baidu.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/you_get/extractors/baidu.py b/src/you_get/extractors/baidu.py index e264f68e..6f558e31 100644 --- a/src/you_get/extractors/baidu.py +++ b/src/you_get/extractors/baidu.py @@ -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): - 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) + print_info('BaiduPan', title, ext, size) if not info_only: + print('Hold on...') + time.sleep(5) download_urls([real_url], title, ext, size, output_dir, url, merge=merge, faker=True) 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 = title_wrapped['wrapper'] logging.debug(real_url) - print_info(site_info, title, ext, size) - print('Hold on...') - time.sleep(5) return real_url, title, ext, size