如何批量获取小红书笔记评论
用 3 个接口:小红书笔记搜索 → 小红书笔记评论 → 小红书评论回复。下面的示例一共 14 次调用,合计 $0.28;失败的调用不收费。
按关键词搜出一批小红书笔记,取每篇笔记下的一级评论,再展开回复多的评论。最后得到一张评论表:正文、评论者、点赞数、回复数、发布时间。
第 1 步:小红书笔记搜索
按搜索词取一页笔记,sort 可以选最新或最热。每条的 id 是笔记编号,原样传给下一步;metrics.comments 是评论数,可以先挑评论多的。
curl -G "https://onefeedapi.com/v1/xiaohongshu/notes/search" \ --data-urlencode "query=咖啡" \ -H "Authorization: Bearer $ONEFEED_API_KEY"
# pip install onefeedapi from onefeedapi import OneFeedAPI dx = OneFeedAPI() # reads ONEFEED_API_KEY result = dx.xiaohongshu.notes.search(query="咖啡") print(result["data"]["items"])
// npm i @onefeedapi/sdk import { OneFeedAPI } from "@onefeedapi/sdk"; const dx = new OneFeedAPI(); // reads ONEFEED_API_KEY const result = await dx.xiaohongshu.notes.search({ query: "咖啡" }); console.log(result.data.items);
onefeedapi call xiaohongshu.notes.search 'query=咖啡'{
"code": "ok",
"request_id": "d2403177-e4f6-4d04-99eb-afce599b4c31",
"data": {
"items": [
{
"id": "67d5e2be00000000d803d22d",
"url": "https://www.xiaohongshu.com/explore/67d5e2be00000000d803d22d",
"type": "image",
"title": "实测一个月咖啡,结论有点意外",
"text": "把咖啡从头到尾讲清楚,看完少走弯路",
"published_at": "2026-05-17T05:25:25.000Z",
"author": {
"id": "6130783200000000883b2a1e",
"username": "coffee_lab_sh",
"name": "山野咖啡馆",
"avatar_url": "https://sns-avatar-qc.xhscdn.com/avatar/610f17040000000049dd4887.jpg"
},
"metrics": {
"likes": 48,
"comments": 21,
"shares": 5,
"favorites": 10
},
"images": [
"https://sns-webpic-qc.xhscdn.com/20261010/2d7c7c32da67d3c3d839!nd_dft_wlteh_webp_3"
]
},
// … 另有 14 条
]
},
"page": {
"next_cursor": "c1.Ip12-f4dS4HmSDpdPex7WuLPBr1zJAbdhL_Wj8K0",
"cursor_expires_at": "2026-10-12T19:43:26.000Z",
"has_more": true,
"returned": 15
},
"warnings": [],
"meta": {
"capability": "xiaohongshu.notes.search",
"result_status": "complete",
"fetched_at": "2026-10-12T18:43:26.000Z",
"cached": false,
"replayed": false,
"unavailable": {
"lang": "capability",
"metrics.views": "platform",
"metrics.reposts": "platform",
"author.verified": "capability",
"author.followers": "capability",
"hashtags": "capability",
"mentions": "capability",
"is_pinned": "capability",
"post_id": "platform",
"parent_id": "platform",
"root_id": "platform"
},
"billing": {
"amount": "0.02",
"currency": "USD",
"balance_after": "9.98"
}
}
}取自 2026-10-12 18:43 UTC 录下的真实返回。名字、正文和编号是示例,链接也是,都不是录到的原文(页面不展示任何人的个人信息);数字是原样。长列表做了截断。请求号、游标和余额是示意。
小红书笔记搜索 · $0.0200 / 一次 · 参数、字段和报错见接口页 →
第 2 步:小红书笔记评论
把笔记编号放进 id,取一页一级评论,按时间从新到旧。要下一页,就把 page.next_cursor 作为 cursor 再调一次。每条评论的 id、post_id 和回复数 metrics.comments,下一步用。
curl -G "https://onefeedapi.com/v1/xiaohongshu/notes/comments/list" \ --data-urlencode "id=6a9c5884000000002b002d95" \ -H "Authorization: Bearer $ONEFEED_API_KEY"
# pip install onefeedapi from onefeedapi import OneFeedAPI dx = OneFeedAPI() # reads ONEFEED_API_KEY result = dx.xiaohongshu.notes.comments.list(id="6a9c5884000000002b002d95") print(result["data"]["items"])
// npm i @onefeedapi/sdk import { OneFeedAPI } from "@onefeedapi/sdk"; const dx = new OneFeedAPI(); // reads ONEFEED_API_KEY const result = await dx.xiaohongshu.notes.comments.list({ id: "6a9c5884000000002b002d95" }); console.log(result.data.items);
onefeedapi call xiaohongshu.notes.comments.list id=6a9c5884000000002b002d95
{
"code": "ok",
"request_id": "fd58d135-ef6e-4271-869d-fbb8d27199ce",
"data": {
"items": [
{
"id": "68d0607400000000edd345fe",
"text": "我上次也踩了这个坑哈哈",
"published_at": "2026-10-11T13:28:37.000Z",
"author": {
"id": "6da35157000000005fdd7a79",
"username": "nanfeng_0721",
"name": "南边的风",
"avatar_url": "https://sns-avatar-qc.xhscdn.com/avatar/65250da200000000167ab981.jpg"
},
"metrics": { "likes": 0, "comments": 0 },
"post_id": "6696eaf60000000000904fc3",
"parent_id": null,
"root_id": null
},
// … 另有 9 条
]
},
"page": {
"next_cursor": "c1.lk7Qsam6A9ERrgAE_Wv8XIQJG0N-AN_z2Xy0yA78",
"cursor_expires_at": "2026-10-12T19:43:50.000Z",
"has_more": true,
"returned": 10
},
"warnings": [],
"meta": {
"capability": "xiaohongshu.notes.comments.list",
"result_status": "complete",
"fetched_at": "2026-10-12T18:43:50.000Z",
"cached": false,
"replayed": false,
"unavailable": { "url": "platform" },
"billing": {
"amount": "0.02",
"currency": "USD",
"balance_after": "9.98"
}
}
}取自 2026-10-12 18:43 UTC 录下的真实返回。名字、正文和编号是示例,链接也是,都不是录到的原文(页面不展示任何人的个人信息);数字是原样。长列表做了截断。请求号、游标和余额是示意。
小红书笔记评论 · $0.0200 / 一次 · 参数、字段和报错见接口页 →
第 3 步:小红书评论回复
挑回复多的评论,把它的 id 放进 id、post_id 放进 post_id,取这条评论下的回复。每条回复的 parent_id 是它直接回的那一条。
curl -G "https://onefeedapi.com/v1/xiaohongshu/comments/replies/list" \ --data-urlencode "id=6a9c5c160000000015022a5c" \ --data-urlencode "post_id=6a9c5884000000002b002d95" \ -H "Authorization: Bearer $ONEFEED_API_KEY"
# pip install onefeedapi from onefeedapi import OneFeedAPI dx = OneFeedAPI() # reads ONEFEED_API_KEY result = dx.xiaohongshu.comments.replies.list(id="6a9c5c160000000015022a5c", post_id="6a9c5884000000002b002d95") print(result["data"]["items"])
// npm i @onefeedapi/sdk import { OneFeedAPI } from "@onefeedapi/sdk"; const dx = new OneFeedAPI(); // reads ONEFEED_API_KEY const result = await dx.xiaohongshu.comments.replies.list({ id: "6a9c5c160000000015022a5c", post_id: "6a9c5884000000002b002d95" }); console.log(result.data.items);
onefeedapi call xiaohongshu.comments.replies.list id=6a9c5c160000000015022a5c post_id=6a9c5884000000002b002d95
{
"code": "ok",
"request_id": "73e9cdd5-25d4-43a3-8ab7-2b772d6dc423",
"data": {
"items": [
{
"id": "6b61353f00000000bc461a89",
"text": "收藏了,周末就去试试",
"published_at": "2026-09-05T18:19:37.000Z",
"author": {
"id": "6fae30ea000000006c636e24",
"username": "aya_living",
"name": "认真生活的阿雅",
"avatar_url": "https://sns-avatar-qc.xhscdn.com/avatar/66909e6f00000000f1d7fcc8.jpg"
},
"metrics": { "likes": 639 },
"post_id": "66f902af00000000446f66ed",
"parent_id": "637d056a000000009ef97bd5",
"root_id": "6516fd30000000006f684b97"
},
// … 另有 4 条
]
},
"page": {
"next_cursor": "c1.LyZyLf38XXqnHCcC989t2SLQpglHo8Vxq-bqAIPK",
"cursor_expires_at": "2026-10-12T19:43:51.000Z",
"has_more": true,
"returned": 5
},
"warnings": [],
"meta": {
"capability": "xiaohongshu.comments.replies.list",
"result_status": "complete",
"fetched_at": "2026-10-12T18:43:51.000Z",
"cached": false,
"replayed": false,
"unavailable": { "url": "platform", "metrics.comments": "platform" },
"billing": {
"amount": "0.02",
"currency": "USD",
"balance_after": "9.98"
}
}
}取自 2026-10-12 18:43 UTC 录下的真实返回。名字、正文和编号是示例,链接也是,都不是录到的原文(页面不展示任何人的个人信息);数字是原样。长列表做了截断。请求号、游标和余额是示意。
小红书评论回复 · $0.0200 / 一次 · 参数、字段和报错见接口页 →
示例花多少钱
一页搜索结果,前 10 篇笔记各取第一页评论,再展开其中 3 条评论的回复
价格是生成本页时的现行价格。失败的调用不收费。
在 AI 里做(MCP)
把 OneFeedAPI 接进你的 AI 客户端,只要接一次。之后直接说要什么,代理自己找到这些接口、看好价格,用你的余额调用。
{
"capability": "xiaohongshu.notes.search",
"query": "咖啡",
"idempotency_key": "<a new UUID>"
}用 Skill 做
为什么用 OneFeedAPI
- 稳定:近 30 天接口可用 100%,状态页公开,可以自己核对。
- 快:近 7 天付费调用的中位耗时 1.3 秒(2026-11-06 统计)。
- 省 token:小红书的 21 个接口各取一份录制的真实返回,平台原始 JSON 合计 48 万 token,AI 通过 OneFeedAPI 的 MCP 读到的只有 3.6 万 token,少 92%;直接调接口拿到的 JSON 也少 85%(2026-11-06 统计)。所有平台同一种格式:作者在
author,互动数在metrics,翻页用page.next_cursor,换平台不用重写解析。 - 先看再用:每个接口的页面上都有一份录制的真实返回,字段一目了然。
- 花钱可控:失败不收费;每把 Key 能设金额上限,
X-Max-Price限定一次最多花多少,同一个Idempotency-Key24 小时内不重复扣费。 - 接 AI 方便:远程 MCP 服务已在 MCP 官方登记处登记(
com.onefeedapi/mcp),Claude、Cursor、ChatGPT 都能直接用。 - 免费试用,最多 333 次,不用绑卡。
要知道的
- 评论一页通常 10 条、最多 20 条,只有一级评论,回复要用回复接口取。
page.next_cursor一小时内有效。 - 笔记编号是 24 位十六进制。编号对不上任何笔记时,评论接口返回“不存在”,不扣费。
- 评论没有单独的链接(
url)。IP 属地只在平台显示时才有,加view=full,在ext.ip_location里。
完整脚本
上面这件事写成一个能直接跑的脚本:Python,用 SDK,Key 从 ONEFEED_API_KEY 读。它写出一个 CSV 文件,最后打印调了几次、取到几条、扣了多少。
# pip install onefeedapi # export ONEFEED_API_KEY=dx_... (your key) import csv from decimal import Decimal from onefeedapi import OneFeedAPI dx = OneFeedAPI() calls, fetched, charged = 0, 0, Decimal("0") def run(capability, params): """One call; counts it and what it was charged.""" global calls, charged result = dx.call(capability, params) calls += 1 charged += Decimal(str(result["meta"]["billing"]["amount"])) return result QUERY = "露营" NOTES = 5 # 1. A page of notes for the search terms. notes = run("xiaohongshu.notes.search", {"query": QUERY})["data"]["items"][:NOTES] # 2. The first page of comments under each note. rows = [] for note in notes: for comment in run("xiaohongshu.notes.comments.list", {"id": note["id"]})["data"]["items"]: rows.append([note["id"], comment.get("published_at"), comment["author"].get("name"), comment["metrics"].get("likes"), comment.get("text")]) fetched = len(rows) with open("xiaohongshu-comments.csv", "w", newline="", encoding="utf-8") as file: csv.writer(file).writerows([["note_id", "published_at", "commenter", "likes", "text"], *rows]) print(f"calls: {calls}, items: {fetched}, charged: ${charged}")
2026-10-29 真实跑过一次:调用 6 次,写出 50 行,扣费 $0.12。失败的调用不收费。