mirror of
https://github.com/soimort/you-get.git
synced 2025-02-09 03:37:52 +03:00
Baidu: fix download link from outside mainland China
This commit is contained in:
parent
39068f09e8
commit
aae2a6cfdc
@ -36,12 +36,17 @@ def baidu_download_lyric(sid, file_name, output_dir):
|
|||||||
x.write(lrc)
|
x.write(lrc)
|
||||||
|
|
||||||
def baidu_download_song(sid, output_dir = '.', merge = True, info_only = False):
|
def baidu_download_song(sid, output_dir = '.', merge = True, info_only = False):
|
||||||
|
try:
|
||||||
html = baidu_get_song_html(sid)
|
html = baidu_get_song_html(sid)
|
||||||
url = baidu_get_song_url(html)
|
url = baidu_get_song_url(html)
|
||||||
title = baidu_get_song_title(html)
|
title = baidu_get_song_title(html)
|
||||||
artist = baidu_get_song_artist(html)
|
artist = baidu_get_song_artist(html)
|
||||||
album = baidu_get_song_album(html)
|
album = baidu_get_song_album(html)
|
||||||
assert url
|
assert url
|
||||||
|
except:
|
||||||
|
html = get_html("http://music.baidu.com/song/%s" % sid)
|
||||||
|
url = r1(r'download_url="([^"]+)"', html)
|
||||||
|
title = r1(r'sname="([^"]+)"', html)
|
||||||
|
|
||||||
type, ext, size = url_info(url, faker = True)
|
type, ext, size = url_info(url, faker = True)
|
||||||
print_info(site_info, title, type, size)
|
print_info(site_info, title, type, size)
|
||||||
|
Loading…
Reference in New Issue
Block a user