diff --git a/src/you_get/common.py b/src/you_get/common.py index e1477034..6244c579 100755 --- a/src/you_get/common.py +++ b/src/you_get/common.py @@ -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', diff --git a/src/you_get/extractors/netease.py b/src/you_get/extractors/netease.py index 16f67144..e838878b 100644 --- a/src/you_get/extractors/netease.py +++ b/src/you_get/extractors/netease.py @@ -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