本节目标:解决无限反调试,下载周杰伦歌曲
1.反调试
2.搜索列表
import requests
res = requests.post(
url="https://zz123.com/ajax/",
data={
"act": "search",
"key": "周杰伦",
"lang": "",
"page": 1
}
)
res_dict = res.json()
data_list = res_dict['data']
for item in data_list:
print(item)
3.MP3下载
import requests
res = requests.get(url="https://zz123.com/xplay/?act=songplay&id=vakas", allow_redirects=False)
mp3_url = res.headers['Location']
res = requests.get(url=mp3_url)
with open("晴天.mp3", mode='wb') as f:
f.write(res.content)
4.批量下载
import requests
import requests
res = requests.post(
url="https://zz123.com/ajax/",
data={
"act": "search",
"key": "周杰伦",
"lang": "",
"page": 1
}
)
res_dict = res.json()
data_list = res_dict['data']
for item in data_list:
mp3_id = item['id']
mp3_name = item['mname']
# 获取真正mp3地址
res = requests.get(
url=f"https://zz123.com/xplay/?act=songplay&id={mp3_id}",
allow_redirects=False
)
real_mp3_url = res.headers['Location']
# 下载
res = requests.get(url=real_mp3_url)
with open(f'{mp3_name}.mp3', mode='wb') as f:
f.write(res.content)
标签:07,url,res,mp3,zz123,requests,data,周杰伦,调试
From: https://www.cnblogs.com/fuminer/p/18013186