Skip to content

Algorithms to generate websectiga have changed #9

@AminSaffar-hub

Description

@AminSaffar-hub

trace:

200 | POST | https://as.xiaohongshu.com/api/sec/v1/scripting | data:"{\"appId\":\"xhs-pc-web\",\"callback\":\"\",\"callFrom\":\"web\",\"type\":\"ds\"}"
Traceback (most recent call last):
  File "/Users/modamine/RedCrack/get_note.py", line 24, in <module>
    asyncio.run(main())
  File "/Users/modamine/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Users/modamine/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/modamine/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/modamine/RedCrack/get_note.py", line 20, in main
    await guest_demo()
  File "/Users/modamine/RedCrack/get_note.py", line 8, in guest_demo
    xhs_session = await create_xhs_session(proxy=proxy)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/modamine/RedCrack/request/web/xhs_session.py", line 422, in create_xhs_session
    await session._initialize()
  File "/Users/modamine/RedCrack/request/web/xhs_session.py", line 100, in _initialize
    await self.__init_cookies()
  File "/Users/modamine/RedCrack/request/web/xhs_session.py", line 69, in __init_cookies
    await self.__set_websectiga_and_secPoisonId()
  File "/Users/modamine/RedCrack/request/web/xhs_session.py", line 134, in __set_websectiga_and_secPoisonId
    "websectiga": self.__xhs_encrypt.gen_websectiga(res_json.get('data').get('data')),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/modamine/RedCrack/request/web/encrypt/cookie/websectiga.py", line 49, in gen_websectiga
    b, d = self.__get_jsvmpdata(js_text)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/modamine/RedCrack/request/web/encrypt/cookie/websectiga.py", line 17, in __get_jsvmpdata
    b = re.search(r'"b":"(.*?)",', js_text).group(1)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'

The response of the api/sec/v1/scripting no longer contains 'b' and 'd' values used to generate the websectiga token.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions