前几天想抓个歌单来着,调下之前的api
发现获取歌单音乐列表失败了,于是跟进去分析,仅供参考学习
Ps. 刚分析完,好像现在又变了,有空再写
歌单url
地址 https://music.163.com/#/playlist?id=2871000053
主要html
分析
<div id="song-list-pre-cache" data-key="track_playlist-2871000053" data-simple="1" data-pvnamed="1">
<div class="u-load s-fc4"><i class="icn"></i> 加载中...</div>
<ul class="f-hide">
<li><a href="/song?id=29567193">我们的时光</a></li>
<li><a href="/song?id=1368771736">那个时候</a></li>
<li><a href="/song?id=417596830">美好事物</a></li>
<li><a href="/song?id=450048216">只道寻常</a></li>
<li><a href="/song?id=1368771318">莎娜姑娘</a></li>
<li><a href="/song?id=1328365527">阿坤</a></li>
<li><a href="/song?id=540070780">大理</a></li>
<li><a href="/song?id=1323068816">火柴盒里的时光</a></li>
<li><a href="/song?id=1372796817">曾经的我们</a></li>
<li><a href="/song?id=1308946786">二十一岁的她</a></li>
<li><a href="/song?id=1353150950">我以为世界荒芜还有你</a></li>
<li><a href="/song?id=1357807527">西部猎人</a></li>
<li><a href="/song?id=864099827">是的,你是</a></li>
<li><a href="/song?id=558238661">你就是星光</a></li>
<li><a href="/song?id=424495049">城南的孩子</a></li>
<li><a href="/song?id=1334295185">写给黄淮</a></li>
<li><a href="/song?id=482044211">给你</a></li>
<li><a href="/song?id=35476049">这个年纪</a></li>
<li><a href="/song?id=418990139">走歌人</a></li>
<li><a href="/song?id=27562607">理想与爱情</a></li>
<li><a href="/song?id=31445772">理想三旬</a></li>
<li><a href="/song?id=445546453">浮生</a></li>
<li><a href="/song?id=416890049">亲爱的你</a></li>
<li><a href="/song?id=41634014">来日方长</a></li>
<li><a href="/song?id=28661071">忆她</a></li>
<li><a href="/song?id=411754937">夕阳下的歌</a></li>
<li><a href="/song?id=408280671">我想和你吃个饭</a></li>
<li><a href="/song?id=67350">今生缘</a></li>
<li><a href="/song?id=28310935">无能为力</a></li>
<li><a href="/song?id=34248486">致我亲爱的朋友</a></li>
<li><a href="/song?id=350760">农夫渔夫</a></li>
<li><a href="/song?id=28968068">那年我十八岁</a></li>
<li><a href="/song?id=31890233">后知后觉</a></li>
<li><a href="/song?id=430208143">在四季里等待</a></li>
<li><a href="/song?id=405253305">写给你的歌</a></li>
<li><a href="/song?id=33166564">最后一次看着你</a></li>
<li><a href="/song?id=27808295">平淡日子里的刺</a></li>
<li><a href="/song?id=28310921">狗日的青春</a></li>
<li><a href="/song?id=41651095">无忧房客</a></li>
<li><a href="/song?id=5239277">桑吉尔多</a></li>
<li><a href="/song?id=1359382613">我愿</a></li>
<li><a href="/song?id=442016663"><小智></a></li>
<li><a href="/song?id=544070223">探清水河</a></li>
<li><a href="/song?id=28940202">十月迷城</a></li>
<li><a href="/song?id=512524510">幻色</a></li>
<li><a href="/song?id=421563082">当我要走的时候</a></li>
<li><a href="/song?id=135085">封锁线</a></li>
<li><a href="/song?id=1293953560">抱影而眠</a></li>
<li><a href="/song?id=1330993997">隐身药水</a></li>
<li><a href="/song?id=202342">你就是我最想要的丫头</a></li>
</ul>
<!-- 这里是详细的歌曲列表详细数据,以前是明文,近期加密了 -->
<textarea id="song-list-pre-data" style="display:none;">Qvw9BaxfyjHR4gaTVQ5a1++ZO50DLu7N7eoObg4W/0X9gLFLLIbN7JdULj3t3TSVQZFI2wYSjS5OmDsBPkZ7G4jaRkWkqXgCBW/qb1VaQ5Sz5WL+qK54a9voAN7TAWGA745F2YHb5pKrFQh96joTxoA==</textarea>
</div>
主要是对id
为song-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
}
]
搞定,细节就不去折腾了,有空再说,另本文仅参考学习