代码如下:


def getyunpan(user,pwd,platlistid=587771511):
    musicDatas = []
    import requests
    import json
    root = "http://localhost:3000"
    cmd = f"/login/cellphone?phone={user}&password={pwd}"
    cmd = root + cmd
    res = requests.get(cmd)
    cmd = "/playlist/detail?id=587771511"
    cmd = root + cmd
    res = requests.get(cmd,cookies=res.cookies)
    res_dict = json.loads(res.text)
    arr = res_dict["playlist"]["tracks"]
    for obj in arr:
        temp = {}
        # print("=" * 20)
        # print(obj["id"])
        # print(obj["name"])
        # print(obj["ar"][0]["name"])
        # print(obj["al"]["picUrl"])
        # print("=" * 20)
        temp["name"] = obj["name"]
        temp["url"] = f'http://music.163.com/song/media/outer/url?id={obj["id"]}.mp3'
        temp["picUrl"] = obj["al"]["picUrl"]
        temp["singer"] = obj["ar"][0]["name"]
        musicDatas.append(temp)
    return musicDatasView Code
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    
    









