ReaJason / xhs

基于小红书 Web 端进行的请求封装。https://reajason.github.io/xhs/
MIT License
1.13k stars 306 forks source link

有什么办法可以通过 note_id 获取 xsec_token 吗? #128

Open Tonwed opened 1 month ago

Tonwed commented 1 month ago

目前想尝试分享笔记直接拼接了url https://www.xiaohongshu.com/explore/66c31bc4000000001d03b63d 但是这个链接未登录的用户和手机端都无法直接访问到该笔记详情 必须得加上对应的xsec_token参数才可以 https://www.xiaohongshu.com/explore/66c31bc4000000001d03b63d?xsec_token=GBF7Fsgu9eGqN4a5BDROj3mRAw8BoUaaGF2b6fJzhLpeo=

目前我获取xsec_token的地方,在创作者中心获取发布笔记的列表,里面包含自己发布的每个笔记对应的xsec_token /api/galaxy/creator/note/user/posted

{ "id": "66c31bc4000000001d03b63d", "time": "2024-08-19 18:17", "timestamp": null, "type": "video", "likes": 1, "sticky": false, "level": 4, "display_title": "\uD83E\uDD23师傅说他切糕很牛掰,非要我拍一下。。", "view_count": 2117, "shared_count": 0, "comments_count": 0, "collected_count": 1, "video_info": { "duration": 9 }, "images_list": [ { "url": "http://sns-img-hw.xhscdn.com/spectrum/1040g34o316m76furgm0g5n16gq11u51onhgbb8g?imageView2/2/w/1080/format/jpg" } ], "permission_code": 0, "permission_msg": "", "post_timing": false, "schedule_post_time": 0, "high_self": 0, "tab_status": 1, "goods_info": null, "xsec_token": "GBF7Fsgu9eGqN4a5BDROj3mRAw8BoUaaGF2b6fJzhLpeo=", "xsec_source": "pc_creatormng" }

但是如果不是自己笔记就不知道怎么获取 note_id 对应的 xsec_token 了

cpj10010 commented 3 days ago

同问