其他分享
首页 > 其他分享> > 网易音乐下载api

网易音乐下载api

作者:互联网

def download(song_id,text):
    try:
        url = 'http://music.163.com/song/media/outer/url?id=' + str(song_id)
        response = requests.get(url)
        content = response.content
        save_(content,text)
    except Exception as e:
        print('网易下载模块出错,请检查相关问题\n'+str(e))
def save_(content,text):
    try:
        path = os.path.dirname(os.path.abspath("__file__"))+('\music\\'+text+'.mp3')
        with open(path,mode='wb')as f:
            f.write(content)
    except Exception as e:
        print('保存文件出错,请检查相关模块\n'+str(e))

标签:网易,song,url,text,content,api,path,id,下载
来源: https://www.cnblogs.com/addPath/p/15743093.html