网易云评论不行啊
jusk9527 opened this issue · 0 comments
`# -- coding:utf-8 --
import execjs
import requests
with open("./js.txt", 'r', encoding='utf-8') as f: # 打开JS文件
line = f.readline()
htmlstr = ''
while line:
htmlstr = htmlstr + line
line = f.readline()
jsstr = htmlstr
ctx = execjs.compile(jsstr) # 加载JS文件
a = '"{"rid":"R_SO_4_29738999","offset":"160","total":"false","limit":"20",'
'"csrf_token":"de097d5986487c4aefe9f52c65e43224"}"}'
b = "010001"
c = "00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17"
"a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114"
"af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef5"
"2741d546b8e289dc6935b3ece0462db0a22b8e7"
d = "0CoJUm6Qyw8W8jud"
sp = ctx.call(
"getdata", a, b, c, d)
print(sp)
headers={
"Accept": "/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Connection": "keep-alive",
"Content-Length": "480",
"Content-Type": "application/x-www-form-urlencoded",
"Cookie": "_ntes_nnid=59be66a8c726dbfd6054c68d55f190ad,1553912032957; vinfo_n_f_l_n3=7f7f165121dec647.1.0.1553912033010.0.1553912570160; iuqxldmzr=32; WM_NI=En4uBa1AHjZK7aGRniP2ghr%2FqODG%2BnUpzGslKFwrPbzCOPk9o3bIM%2Fi5We0NPlCMuxqFyor3GSpvkIgcXziYBguVHMbnTYUbd3S9pR8EitwLwkxJubz1f%2BhYsunhYIWfMjQ%3D; WM_NIKE=9ca17ae2e6ffcda170e2e6ee83cc4e8e89f7acef508b8a8eb6c55b868f8fabb8629691899ab739f19685dae62af0fea7c3b92a87b2fc96c16bf39f888bd941f5bf89b3ed6394eea989f125b3918ca8aa6697b0b6a8f268899ab993d36aba9d81b1ea33adedaeaad025abeb9986b34694b48daef874b39ab790f139858dc097ea43a5bd989bec5382b9bbb7cb47a2b29cbad86aa8ed9ddaf35afc9ba795f648b5b5b8abf86abaefaacceb53b1aba289dc4395ba838bd437e2a3; WM_TID=jkPENGGRPx5FEBABUQYsiUKX38j2Zbs1; playerid=49550111; JSESSIONID-WYYY=ccc%2BjqOrGIJxeEx5X46858s8Xz5d%2BTxagzIeY68xDPmPE5oa2co2jsG0iIgcflcjDWgweG6rfrqVv9YlqZZ5ARtzn%2F6Pxp%2B%5CwrIo5YD8K%5CU9leIAx7vhODcqy%2FOEacV1AOVwieKPuUCD5PVrxTvPDzKqOmyFV3jV8DIcd5qWqyJ1WKV8%3A1555252102998",
"DNT": "1",
"Host": "music.163.com",
"Origin": "https://music.163.com",
# "Referer": "https://music.163.com/song?id=29738999",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36",
}
url = "https://music.163.com/weapi/v1/resource/comments/R_SO_4_29738999?csrf_token="
response = requests.post(url=url, data=sp, headers=headers)
print(response.text)
`
这时候返回response 是为空。但是我们直接拿到正确的params和encSecKey。是可以拿到数据的。