mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 21:45:02 +03:00
fix m5.music.126.net return 404
This commit is contained in:
parent
af8d827d57
commit
9c0abc6c64
@ -348,6 +348,7 @@ def url_info(url, faker = False, headers = {}):
|
||||
headers = response.headers
|
||||
|
||||
type = headers['content-type']
|
||||
if type == 'image/jpg; charset=UTF-8' or type == 'image/jpg' : type = 'audio/mpeg' #fix for netease
|
||||
mapping = {
|
||||
'video/3gpp': '3gp',
|
||||
'video/f4v': 'flv',
|
||||
|
@ -94,13 +94,14 @@ def netease_video_download(vinfo, output_dir='.', info_only=False):
|
||||
|
||||
def netease_song_download(song, output_dir='.', info_only=False):
|
||||
title = "%s. %s" % (song['position'], song['name'])
|
||||
songNet = 'p' + song['mp3Url'].split('/')[2][1:]
|
||||
|
||||
if 'hMusic' in song and song['hMusic'] != None:
|
||||
url_best = make_url(song['hMusic']['dfsId'])
|
||||
url_best = make_url(songNet, song['hMusic']['dfsId'])
|
||||
elif 'mp3Url' in song:
|
||||
url_best = song['mp3Url']
|
||||
elif 'bMusic' in song:
|
||||
url_best = make_url(song['bMusic']['dfsId'])
|
||||
url_best = make_url(songNet, song['bMusic']['dfsId'])
|
||||
|
||||
netease_download_common(title, url_best,
|
||||
output_dir=output_dir, info_only=info_only)
|
||||
@ -165,9 +166,9 @@ def encrypted_id(dfsId):
|
||||
return result
|
||||
|
||||
|
||||
def make_url(dfsId):
|
||||
def make_url(songNet, dfsId):
|
||||
encId = encrypted_id(dfsId)
|
||||
mp3_url = "http://m5.music.126.net/%s/%s.mp3" % (encId, dfsId)
|
||||
mp3_url = "http://%s/%s/%s.mp3" % (songNet, encId, dfsId)
|
||||
return mp3_url
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user