今天又更新了,分析流程不再复写。
可以看之前文章:http://www.lxspider.com/?p=324
主要生成流程变动不大,一些计算参数更新,增加了canvas和webGL一些方法和属性。
请求部分
import requests
import execjs
import json
def feed(source_note_id,web_session,a1):
headers = {
"accept":"application/json, text/plain, */*",
"cache-control":"no-cache",
"content-type":"application/json;charset=UTF-8",
"cookie":f"a1={a1}; web_session={web_session};",
"origin":"https://www.xiaohongshu.com",
"referer":"https://www.xiaohongshu.com/",
"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36",
"x-b3-traceid":"a31fffc0ee4f5d8f",
"x-s-common":"",
}
data = {"source_note_id":source_note_id}
exc = execjs.compile(open('xs20230531.js', 'r', encoding='utf-8').read())
xs_xt = exc.call('get_xs','/api/sns/web/v1/feed',data,a1)
xs_xt['X-t'] = str(xs_xt['X-t'])
headers.update(xs_xt)
feed = 'https://edith.xiaohongshu.com/api/sns/web/v1/feed'
print(requests.post(url=feed, data=json.dumps(data, separators=(",", ":")), headers=headers).text)
def aweme(user_id,websession,a1):
url = f'https://edith.xiaohongshu.com/api/sns/web/v1/user_posted?num=30&cursor=&user_id={user_id}'
exc = execjs.compile(open('xs20230531.js', 'r', encoding='utf-8').read())
xs_xt = exc.call('get_xs',f'/api/sns/web/v1/user_posted?num=30&cursor=&user_id={user_id}',None,a1)
headers={
"accept": "application/json, text/plain, */*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-US;q=0.7",
"cache-control": "no-cache",
"cookie":f"a1={a1}; web_session={websession}",
"f": "58",
"origin": "https://www.xiaohongshu.com",
"pragma": "no-cache",
"referer": "https://www.xiaohongshu.com/",
"sec-ch-ua": "\"Chromium\";v=\"110\", \"Not A(Brand\";v=\"24\", \"Google Chrome\";v=\"110\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
"x-b3-traceid": "9ac6343913834a97",
"x-s": "1gFGZBkJ0jTKslZkOjdBsBvpZYsLs6sL1B5iOBU60jT3",
"x-t": "1678676475886"
}
xs_xt['X-t'] = str(xs_xt['X-t'])
headers.update(xs_xt)
print(requests.get(url=url, headers=headers).text)
if __name__ == '__main__':
web_session = "030037a345b1535713616ba30e234a8f99377b"
a1 = "188706f0ceb9v7auxthde944berpka92l8vw5534550000107754"
feed("62d4e8a800000000120019dd",web_session,a1)
aweme('54cef5662e1d935ac4b3f554',web_session,a1)
更新的JS
【温馨提示:此处隐藏内容需要付费订阅后才能查看!】