/AI-agent-rednote

AI agent for www.xiaohongshu.com thread

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

AI agent rednote

AI agent for www.xiaohongshu.com thread

image-20250805130041495

Acknowledgement

xhshow (modified)

Install

Make sure you have a rednote social media account.

Create and activate a Python 3.12 virtual environment. Set the current directory to the program's root directory. Run the following command.

pip install -r requirements.txt

If you have Chromium-based browsers, please install J2TEAM cookies extension. Otherwise, you need to find an alternative extension or manually copy any website's cookies from browser.

Note

Function auth.dump_cookies is designed to load J2TEAM output files. If you use an alternative extension or manually paste the cookies, you need to modify this function, because pasted cookies table is in different format.

The output table of auth.dump_cookies must have the following columns at least:

  • name
  • value
  • expirationDate the expiry date of this cookies item

Other columns are ignored.

The output table must be saved in CSV format.

Get an OpenAI API key for a model which supports function calling, for example gpt-4o. This program calls gpt-4o by default if not customized.

Usage

Activate a Python 3.12 virtual environment.

Set the current directory to the program's root directory.

Run the following command.

python app.py

In the popped-up web page,

  • Navigate to "Settings" page. Fill in OpenAI API key and choose the model.
  • Navigate to "Cookies" page. Upload rednote cookies following the instruction.
  • Go back to home page and start chatting.