网易云加密浅析 - 获取歌单音乐列表

前几天想抓个歌单来着,调下之前的api发现获取歌单音乐列表失败了,于是跟进去分析,仅供参考学习

Ps. 刚分析完,好像现在又变了,有空再写

歌单url地址 https://music.163.com/#/playlist?id=2871000053

主要html分析


主要是对idsong-list-pre-data进行解密分析

主要js分析

  • pt_playlist_index.js 歌单列表脚本
  • core.js

直接定位关键字decodeURIComponent备注:这是经过若干繁琐的分析定位的,细节又臭又长,略了

var C4G = cG5L.value || cG5L.defaultValue;
if (gs && bqD4H) {
    if (type == 13) {
        C4G = C4G.slice(2)
    }
    C4G = decodeURIComponent(coj6d(C4G, typeof window[l4p.rv0x()] + gs + bqD4H))
}
C4G = JSON.parse(C4G);

直接打下断点,发现最开始的C4G获取的是那串加密数据,然后经过解密,经过若干计算,返回urlencode的数据

// 省略部分数据
[
    {
        "djid": 0,
        "pv": {
            "id": 29567193,
            "fee": 8,
            "payed": 0,
            "st": 0,
            "pl": 128000,
            "dl": 0,
            "sp": 7,
            "cp": 1,
            "subp": 1,
            "cs": false,
            "maxbr": 999000,
            "fl": 128000,
            "toast": false,
            "flag": 256,
            "preSell": false
        },
        "fee": 8,
        "mv": 366072,
        "alia": [],
        "ar": [
            {
                "id": 6731,
                "name": "赵雷",
                "tns": [],
                "alias": []
            }
        ],
        "al": {
            "id": 3048030,
            "name": "吉姆餐厅",
            "picUrl": "http://p2.music.126.net/PJNV84mjt_mDXEkxtjzB4w==/18957779486268444.jpg",
            "tns": [],
            "pic_str": "18957779486268444",
            "pic": 18957779486268444
        },
        "ftype": 0,
        "t": 0,
        "dt": 270746,
        "tns": null,
        "st": 0,
        "no": 4,
        "pop": 100,
        "cp": 1400821,
        "name": "我们的时光",
        "id": 29567193
    },
    {
        "djid": 0,
        "pv": {
            "id": 1368771736,
            "fee": 8,
            "payed": 0,
            "st": 0,
            "pl": 128000,
            "dl": 0,
            "sp": 7,
            "cp": 1,
            "subp": 1,
            "cs": false,
            "maxbr": 999000,
            "fl": 128000,
            "toast": false,
            "flag": 0,
            "preSell": false
        },
        "fee": 8,
        "mv": 0,
        "alia": [],
        "ar": [
            {
                "id": 5995,
                "name": "小猛",
                "tns": [],
                "alias": []
            }
        ],
        "al": {
            "id": 79517380,
            "name": "那个时候",
            "picUrl": "http://p2.music.126.net/TgndPBnhfdNERKzrOmCgRQ==/109951164111947435.jpg",
            "tns": [],
            "pic_str": "109951164111947435",
            "pic": 109951164111947440
        },
        "ftype": 0,
        "t": 0,
        "dt": 242139,
        "tns": null,
        "st": 0,
        "no": 0,
        "pop": 100,
        "cp": 0,
        "name": "那个时候",
        "id": 1368771736
    },
    {
        "djid": 0,
        "pv": {
            "id": 417596830,
            "fee": 8,
            "payed": 0,
            "st": 0,
            "pl": 128000,
            "dl": 0,
            "sp": 7,
            "cp": 1,
            "subp": 1,
            "cs": false,
            "maxbr": 128000,
            "fl": 128000,
            "toast": false,
            "flag": 66,
            "preSell": false
        },
        "fee": 8,
        "mv": 0,
        "alia": [],
        "ar": [
            {
                "id": 1050282,
                "name": "房东的猫",
                "tns": [],
                "alias": []
            }
        ],
        "al": {
            "id": 34744383,
            "name": "美好事物",
            "picUrl": "http://p2.music.126.net/RsmgVs3F99IfpGOjZ347HA==/18252992533065802.jpg",
            "tns": [],
            "pic_str": "18252992533065802",
            "pic": 18252992533065800
        },
        "ftype": 0,
        "t": 0,
        "dt": 198687,
        "tns": null,
        "st": 0,
        "no": 1,
        "pop": 100,
        "cp": 0,
        "name": "美好事物",
        "id": 417596830
    },
    {
        "djid": 0,
        "pv": {
            "id": 202342,
            "fee": 0,
            "payed": 0,
            "st": 0,
            "pl": 192000,
            "dl": 192000,
            "sp": 7,
            "cp": 1,
            "subp": 1,
            "cs": false,
            "maxbr": 192000,
            "fl": 999000,
            "toast": false,
            "flag": 130,
            "preSell": false
        },
        "fee": 0,
        "mv": 0,
        "alia": [
            "电视剧《嘿!老头》插曲"
        ],
        "ar": [
            {
                "id": 6729,
                "name": "赵照",
                "tns": [],
                "alias": []
            }
        ],
        "al": {
            "id": 20335,
            "name": "你就是我最想要的丫头",
            "picUrl": "http://p2.music.126.net/Rv-9iGld16quldaESdFYBQ==/64871186055820.jpg",
            "tns": [],
            "pic": 64871186055820
        },
        "ftype": 0,
        "t": 0,
        "dt": 252368,
        "tns": null,
        "st": 0,
        "no": 1,
        "pop": 100,
        "cp": 0,
        "name": "你就是我最想要的丫头",
        "id": 202342
    }
]

搞定,细节就不去折腾了,有空再说,另本文仅参考学习

你可能感兴趣的:(网易云加密浅析 - 获取歌单音乐列表)