# Export a RedNote account's notes to CSV with Python

> A Python script that exports a RedNote account's notes to CSV with likes, saves, comments and shares: 200 of Luckin Coffee's notes in 16 seconds.

- URL: https://toolzerhub.com/blog/export-rednote-profile
- Published: 2026-10-12
- Publisher: ToolzerHub (we sell the API this post describes)

## Short answer

- RedNote's open platform covers shop tools, with no API for profiles or notes, so the script reads public profiles through our RedNote API.
- On Luckin Coffee's official account, which has 1,263,918 followers, the latest 200 notes exported to CSV in 11 calls and 16 seconds.
- A call costs 15 credits and returns up to 20 notes, so 1,000 notes take 765 credits.

This Python script exports a RedNote (Xiaohongshu, 小红书) account's notes to CSV: date, title, type, likes, saves, comments and shares for each note, plus the account's follower count. It calls our RedNote API, since RedNote has no API for profiles or notes. On Luckin Coffee's official account, 瑞幸咖啡, it exported the 200 latest notes in 16 seconds.

## What RedNote's API covers

RedNote's [open platform](https://open.xiaohongshu.com/) is for shop tools such as ERP and order printing, and it lists no API for profiles or notes. Our [RedNote API guide](https://toolzerhub.com/blog/rednote-api) has the detail.

## RedNote notes with ToolzerHub

We make ToolzerHub. Our [RedNote API](https://toolzerhub.com/apis/rednote) returns public profiles and their notes as JSON. A profile call returns followers, likes and saves received; a posts call returns 20 notes and a `next_cursor`. Each call costs 15 credits.

You need Python 3, `requests` (`pip install requests`), an API key from [the dashboard](https://app.toolzerhub.com/signup) and the account's profile ID or URL. To find an ID by name, search profiles:

```bash
curl "https://api.toolzerhub.com/v2/rednote/search/profiles?query=瑞幸咖啡" \
  -H "x-api-key: $TOOLZERHUB_API_KEY"
```

The first of 20 results is the verified 瑞幸咖啡 account, `"id": "5bac7d93168a6000019384c5"`, with "Fans 1.3m". A second verified account, 瑞幸咖啡美国, has "Fans 4.2k", so check the follower count before you copy an ID.

## Export the notes to CSV

The script makes one profile call, then pages through the notes 20 at a time with `next_cursor` until `max_pages`. Pinned notes come first, then the rest newest first. The `profile_id_or_url` parameter takes an ID or a profile URL, and the profile's `ndiscovery` field is the note count the script prints. `cell()` puts an apostrophe in front of text that starts with =, +, - or @, so a spreadsheet shows it as text.

```python
import csv
import os
import sys
import time
from datetime import datetime, timezone

import requests

BASE = "https://api.toolzerhub.com/v2/rednote/profiles"
HEADERS = {"x-api-key": os.environ["TOOLZERHUB_API_KEY"]}
FIELDS = ["note_id", "posted", "title", "type", "pinned", "likes", "saves", "comments",
          "shares"]


def cell(value):
    # Spreadsheets run text that starts with = + - or @ as a formula; an apostrophe keeps it text.
    if isinstance(value, str) and value[:1] in ("=", "+", "-", "@", "\t", "\r"):
        return "'" + value
    return value


def get(path, params, tries=5):
    # 429 and 503 are retryable; the error body says how long to wait.
    for attempt in range(tries):
        r = requests.get(f"{BASE}/{path}", headers=HEADERS, params=params, timeout=90)
        if r.status_code not in (429, 503) or attempt == tries - 1:
            r.raise_for_status()
            return r.json()["data"]
        wait = int(((r.json().get("error") or {}).get("details") or {}).get("retryAfter") or r.headers.get("Retry-After") or 5 * (attempt + 1))
        time.sleep(min(wait, 60))


def row(note):
    return {
        "note_id": note["id"],
        "posted": datetime.fromtimestamp(note["create_time"], timezone.utc).date().isoformat(),
        "title": note.get("title") or note.get("desc", "")[:80],
        "type": note.get("type"),
        "pinned": note.get("sticky", False),
        "likes": note.get("likes"),
        "saves": note.get("collected_count"),
        "comments": note.get("comments_count"),
        "shares": note.get("share_count"),
    }


def notes(profile, max_pages):
    cursor = None
    for _ in range(max_pages):
        params = {"profile_id_or_url": profile}
        if cursor:
            params["cursor"] = cursor
        data = get("posts", params)
        yield from data["notes"]
        cursor = data.get("next_cursor")
        if not data.get("has_more") or not cursor:
            break


def main(profile, max_pages=10, out="profile_notes.csv"):
    p = get("profile", {"profile_id_or_url": profile})
    print(f"{p['nickname']}: {p['fans']} followers, {p['ndiscovery']} notes, "
          f"{p['liked']} likes and {p['collected']} saves received")
    seen = set()
    with open(out, "w", newline="", encoding="utf-8-sig") as f:
        writer = csv.DictWriter(f, fieldnames=FIELDS)
        writer.writeheader()
        for note in notes(profile, int(max_pages)):
            if note["id"] not in seen:
                seen.add(note["id"])
                writer.writerow({k: cell(v) for k, v in row(note).items()})
    print(f"wrote {len(seen)} notes to {out}")


if __name__ == "__main__":
    main(*sys.argv[1:])
```

For more history, raise `max_pages`.

## What came out

Run it with the profile ID, a page cap and a file name:

```bash
export TOOLZERHUB_API_KEY=your_key
python rednote_profile.py 5bac7d93168a6000019384c5 10 luckin.csv
```

It printed the lines below in 16.1 seconds and 11 calls, 1 profile call and 10 pages:

```text
瑞幸咖啡: 1263918 followers, 3694 notes, 8276854 likes and 1414420 saves received
wrote 200 notes to luckin.csv
```

The five most-liked notes, with titles in Chinese and emoji removed:

| posted | type | likes | saves | comments | title |
|---|---|---:|---:|---:|---|
| 2026-07-27 | image | 51,502 | 1,952 | 5,729 | 我们赢了！ |
| 2026-08-06 | video | 51,262 | 8,023 | 1,377 | 不同年代下闯祸be like： |
| 2026-07-29 | image | 24,942 | 859 | 3,225 | 妙生笛 |
| 2026-08-10 | image | 23,286 | 1,486 | 3,100 | 恭喜最佳男主角易烊千玺 |
| 2026-08-10 | image | 19,785 | 552 | 1,637 | 再次幸会，最佳男主角！ |

The 200 notes cover about three months, so the account posts about two notes a day. 125 are image notes (`type` is `normal`) and 75 are videos; the median video has 1,909 likes and the median image note 1,354. The median note has 1,513 likes, 336 comments and 170 saves.

Comments outnumber likes on 16 notes. The most-commented is a back-to-school surprise box note, 开学瑞一杯, with 20,482 comments and 17,744 likes.

## What it costs

Each call is 15 credits, so this run was 11 calls and 165 credits. 1,000 notes take 50 pages plus the profile call, 765 credits. You get 100 free credits a month; $19 buys 10,000 credits that never expire, and [plans for higher volume](https://toolzerhub.com/pricing) cover more accounts. Set your key and your first competitor's notes are a CSV in under a minute.

To search RedNote by keyword instead, see [Xiaohongshu search in Python](https://toolzerhub.com/blog/xiaohongshu-search-api-python). For the same job on Douyin, see [does Douyin have an API](https://toolzerhub.com/blog/douyin-api).

We are not affiliated with RedNote or Luckin Coffee.
