通过JS逆向,爬取音乐(仅供学习交流,严禁非法使用)
今天通过JS逆向,爬取自己喜欢的音乐,仅供交流,严禁非法使用。暂时还没有使用协程进行优化。
from platform import system
import requests
import execjs
import os
import re
list_url="https://xxx/discover/toplist?id=3778678"
yuanshi_url = "https://xxxx/#/song?id=1456890009"
song_url="https://m804.music.126.net/20241130225055/087dfd06a3cbb250e40c0aa2831f05c8/jdyyaac/obj/w5rDlsOJwrLDjj7CmsOj/14096443364/1ef1/fbcb/0f38/b9da5caf7a4a498bb7505ed42cbd8d93.m4a?authSecret=000001937d76c2f50e460a3084c81759"
req_url ="https://xxxx/weapi/song/enhance/player/url/v1?csrf_token=4f13f758b430873d83ffc8485fedeb90"
data={
"params": "zIqCIr7rM2ApbSNDyK0sgTCJmhsLPFKuJpXxYoxyU4IVXhiLmjdILy7XfLPZA1/NXynEkeh4ODTuQO70gmJr0ngAyb0KVLzO8V1Vt14Zkp62pq0OBXoOUvt35dbbL7qzfS+JcVgC42fMoxnVBw6jf0qa0GrkqNUPkx5TGh0rtDXCIuW+5Lv6/+WAS/5Tq2Iz3Jiym8+ncx/tO2U5ytLZEg==",
"encSecKey": "5c2f23d9aefbc1c28ae3f9aa0f9bafe42e87439fdda0ef2052f45e53657c11b7862234ad369416f42f1445b53413ec78d94d364d03204adcc281aacdb01d79c1bef179fdbf280cac90303d83935354c9ea281b26a14e3cd7b31ae6f8f6eaa0b9a8ffc30575dc207fa07afc036cca72c30792ab29afe5033dabe15c04ad54e920",
}