# 怎麼把一篇小紅書筆記的全部評論匯出到 Excel？

> 用 API 翻完一篇小紅書筆記下的全部一級評論並存成 CSV：能拿到哪些欄位、每 1,000 條評論多少錢，以及條數為什麼和 App 裡顯示的不一樣。

網頁版：https://okdata.online/zh-hant/answers/xiaohongshu-export-note-comments/

**簡短回答：**用筆記 ID 調 okdata 的小紅書筆記評論介面，一直把游標傳回去直到翻完；每頁約 10 條，$0.035 一次。1,000 條評論需要 100 次呼叫，共 $3.50，每條帶內容、時間、點贊、回覆數和 IP 屬地。

競品有一篇種草筆記下面有 2,000 條評論，你想把它們放進表格，看看使用者到底在吐槽什麼。App 裡往下刷，刷一陣就載入不出來了；用爬蟲，常常只拿到前 10 條，或者翻到一半就超時。下面這個辦法能穩穩翻到底。評論介面會幫你一頁頁翻完，再用一小段指令碼寫成 CSV。

## 用哪個介面

[小紅書筆記評論](/zh/apis/xiaohongshu/notes/comments/list/)介面傳入筆記 ID，每次返回約 10 條評論，每條有評論內容、釋出時間、評論者暱稱和 ID、點贊數、樓下回複數，以及小紅書展示的 IP 屬地。`page.next_cursor` 指向下一頁，`page.has_more` 為 false 就說明翻完了。

筆記 ID 是連結裡 `/explore/` 後面那串 24 位字元。如果手上只有 xhslink.com 分享短鏈，先用 `url=` 調一次[筆記詳情](/zh/apis/xiaohongshu/notes/get/)，從結果裡讀出 `id`。

## 費用

| 評論數 | 呼叫次數 | 費用 |
|---|---|---|
| 200 | 20 | $0.70 |
| 1,000 | 100 | $3.50 |
| 2,000 | 200 | $7.00 |

每一頁返回時單獨扣費。只想抽樣的話，給翻頁次數設個上限。

## 指令碼：筆記 ID 匯出成 CSV

```python
import csv, os, requests

URL = "https://api.okdata.online/v1/xiaohongshu/notes/comments/list"
HEAD = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}
note_id, cursor, max_pages = "6650a1b2000000001e00abcd", None, 200

with open("comments.csv", "w", newline="", encoding="utf-8-sig") as f:
    w = csv.writer(f)
    w.writerow(["published_at", "author", "text", "likes", "replies", "ip_location"])
    for _ in range(max_pages):
        params = {"id": note_id, **({"cursor": cursor} if cursor else {})}
        body = requests.get(URL, headers=HEAD, params=params, timeout=60).json()
        for c in body["data"]["items"]:
            w.writerow([c["published_at"], c["author"]["name"], c["text"], c["likes"], c["replies"], c["ip_location"]])
        if not body["page"]["has_more"]:
            break
        cursor = body["page"]["next_cursor"]
```

用 `utf-8-sig` 編碼儲存，Excel 開啟中文才不會亂碼。

## 為什麼匯出的條數比評論數少

- 筆記上顯示的評論數包含樓中樓回覆。這個介面返回一級評論，回覆只體現在每行的 `replies` 數字裡，不逐條列出。
- 被作者或平台隱藏、刪除的評論不公開，自然拿不到。
- 評論者的粉絲數這裡是 null；值得關注的評論者，可以再用[博主資訊](/zh/apis/xiaohongshu/users/get/)查一下。

## 其他辦法

只有一篇筆記的話，手動複製也行。MediaCrawler 可以用登入帳號連同樓中樓一起抓，前提是你能接受帳號風險。如果要對幾十篇筆記做評論分析，可以參考[口碑分析方案](/zh/solutions/word-of-mouth/)，從搜尋到評論再到彙總，一條流程走完。

## 用到的介面

- [小紅書筆記評論](https://okdata.online/zh/apis/xiaohongshu/notes/comments/list/) `xiaohongshu.notes.comments.list`：$0.035/次 · 每頁約 10 條評論
- [小紅書筆記詳情](https://okdata.online/zh/apis/xiaohongshu/notes/get/) `xiaohongshu.notes.get`：$0.035/次

## 更多小紅書內容

- [小紅書 API](https://okdata.online/zh/apis/xiaohongshu/)
- [小紅書 API Python 教程：筆記、博主和評論（2026）](https://okdata.online/zh/guides/xiaohongshu-api-python/)
- [怎麼按關鍵詞批次匯出小紅書評論](https://okdata.online/zh/guides/xiaohongshu-note-comments/)
- [怎麼在小紅書蒲公英按報價和閱讀量篩達人](https://okdata.online/zh/guides/xiaohongshu-pgy-creator-rates/)
- [怎麼搜尋小紅書筆記並匯出成 CSV 表格](https://okdata.online/zh/guides/xiaohongshu-search-export-notes/)
- [千問裡怎麼拿到抖音、小紅書、公眾號的資料？](https://okdata.online/zh/answers/qwen-douyin-xiaohongshu-data/)
- [騰訊元寶能讀抖音、小紅書的資料嗎？](https://okdata.online/zh/answers/yuanbao-douyin-xiaohongshu-data/)
- [ChatGPT、Claude 為什麼打不開小紅書連結？怎麼讓它讀到筆記？](https://okdata.online/zh/answers/ai-cant-open-xiaohongshu-link/)
- [怎麼在小紅書上找到使用者對某個品牌的吐槽和差評？](https://okdata.online/zh/answers/xiaohongshu-brand-complaints/)
- [怎麼把一篇小紅書筆記的全部評論匯出到 Excel？](https://okdata.online/zh/answers/xiaohongshu-export-note-comments/)
- [有沒有不用掃碼登入的小紅書 MCP？](https://okdata.online/zh/answers/xiaohongshu-mcp-qr-login-expires/)
- [自己爬還是按次呼叫資料介面：成本、維護和風險](https://okdata.online/zh/compare/scraping-vs-data-api/)
- [怎麼選社交媒體資料 API（2026）](https://okdata.online/zh/compare/social-media-data-apis/)
- [社媒資料 MCP 伺服器：自己部署還是用託管的](https://okdata.online/zh/compare/social-media-data-mcp-servers/)

## 資料來源

這個問題出現過的地方（讀取於 2026-11-12）：

- https://github.com/cv-cat/Spider_XHS/issues/73
- https://github.com/ReaJason/xhs/issues/45
- https://github.com/cv-cat/Spider_XHS/issues/14

更新於 2026-11-12
