ReaJason / xhs

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

请问web端获取的cookie方式,我使用扫码登录后没有web_session字段 #52

Closed tzxyz closed 11 months ago

tzxyz commented 11 months ago

我使用example目录下的basic_usage.py 登录小红书web版,获取cookie并复制到代码中 程序逻辑在core.py 129行self.activate处报错,检测后发现我得cookie没有web_session字段

    def cookie(self, cookie: str):
        update_session_cookies_from_cookie(self.__session, cookie)
        if "web_session" not in self.cookie_dict:
            self.activate()
ReaJason commented 11 months ago

不要在 console 中通过 document.cookie 获取,而是在 network 中复制请求中的 cookie

tzxyz commented 11 months ago

已解决,感谢解答

CCCpan commented 2 months ago

除了network还有其他方法吗