diff --git a/src/you_get/downloader/baidu.py b/src/you_get/downloader/baidu.py index 958631e4..245b1d4f 100755 --- a/src/you_get/downloader/baidu.py +++ b/src/you_get/downloader/baidu.py @@ -4,6 +4,7 @@ __all__ = ['baidu_download'] from ..common import * +from .. import common from urllib import parse @@ -11,20 +12,23 @@ def baidu_get_song_html(sid): return get_html('http://music.baidu.com/song/%s/download?__o=%%2Fsong%%2F%s' % (sid, sid), faker = True) def baidu_get_song_url(html): - return r1(r'', html) + href = r1(r'', html) if href: lrc = get_html('http://music.baidu.com' + href) if len(lrc) > 0: @@ -46,10 +50,10 @@ def baidu_download_song(sid, output_dir = '.', merge = True, info_only = False): def baidu_download_album(aid, output_dir = '.', merge = True, info_only = False): html = get_html('http://music.baidu.com/album/%s' % aid, faker = True) - album_name = r1(r'

(.*)<\/h2>', html) - artist = r1(r'', html) + album_name = r1(r'

(.+?)<\/h2>', html) + artist = r1(r'', html) output_dir = '%s/%s - %s' % (output_dir, artist, album_name) - ids = json.loads(r1(r'', html).replace('"', '').replace(';', '"'))['ids'] + ids = json.loads(r1(r'', html).replace('"', '').replace(';', '"'))['ids'] track_nr = 1 for id in ids: song_html = baidu_get_song_html(id)