如何按关键词搜索并导出小红书笔记

用 2 个接口:小红书笔记搜索 → 小红书笔记详情。下面的示例一共 13 次调用,合计 $0.26;失败的调用不收费。

更新于 2026-11-15在 ChatGPT 里打开在 Claude 里打开

按关键词一页页搜小红书笔记,再按编号取完整正文和话题标签。最后得到一张笔记表:标题、正文、作者、点赞收藏评论分享数、图片。

第 1 步:小红书笔记搜索

按搜索词取一页笔记,sort 选综合、最新或最热。要更多,就把 page.next_cursor 作为 cursor 接着翻。这里的 text 只是搜索卡片上的摘录,标题也去掉了表情;每条的 id 拿去下一步取全文。

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(也可以传笔记的网页长链接 url),返回完整正文、话题标签 hashtags、提到的账号 mentions 和图片 images。

curl -G "https://onefeedapi.com/v1/xiaohongshu/notes/get" \
  --data-urlencode "id=6ac76250000000000a021233" \
  -H "Authorization: Bearer $ONEFEED_API_KEY"
# pip install onefeedapi
from onefeedapi import OneFeedAPI

dx = OneFeedAPI()  # reads ONEFEED_API_KEY
result = dx.xiaohongshu.notes.get(id="6ac76250000000000a021233")
print(result["data"]["item"])
// npm i @onefeedapi/sdk
import { OneFeedAPI } from "@onefeedapi/sdk";

const dx = new OneFeedAPI(); // reads ONEFEED_API_KEY
const result = await dx.xiaohongshu.notes.get({ id: "6ac76250000000000a021233" });
console.log(result.data.item);
onefeedapi call xiaohongshu.notes.get id=6ac76250000000000a021233
录制的返回
{
  "code": "ok",
  "request_id": "f71a940b-5096-4ae5-8062-eb8542c0840d",
  "data": {
    "item": {
      "id": "64e3473100000000d2df6d97",
      "url": "https://www.xiaohongshu.com/explore/64e3473100000000d2df6d97",
      "type": "image",
      "title": "周末露营装备清单,新手照着买就行",
      "text": "周末露营|第一次尝试就爱上了,清单放评论区",
      "lang": "zh-Hans",
      "published_at": "2026-10-09T01:00:34.000Z",
      "author": {
        "id": "61a2711e000000007b58eefa",
        "username": "aya_living",
        "name": "认真生活的阿雅",
        "avatar_url": "https://sns-avatar-qc.xhscdn.com/avatar/61177eaf00000000f2be6e0c.jpg"
      },
      "metrics": {
        "likes": 927,
        "comments": 122,
        "shares": 256,
        "favorites": 59
      },
      "images": [
        "https://sns-webpic-qc.xhscdn.com/20261013/beb7fc7264c0ffc27302!nd_dft_wlteh_webp_3",
        "https://sns-webpic-qc.xhscdn.com/20261012/355cf1169dfdc76d1395!nd_dft_wlteh_webp_3",
        // … 另有 7 条
      ],
      "hashtags": [
        "户外生活",
        "好物分享",
        // … 另有 3 条
      ],
      "mentions": [],
      "is_pinned": false
    }
  },
  "warnings": [],
  "meta": {
    "capability": "xiaohongshu.notes.get",
    "result_status": "complete",
    "fetched_at": "2026-10-10T12:46:15.000Z",
    "cached": false,
    "replayed": false,
    "unavailable": {
      "metrics.views": "platform",
      "metrics.reposts": "platform",
      "author.verified": "capability",
      "author.followers": "capability",
      "mentions.username": "platform",
      "post_id": "platform",
      "parent_id": "platform",
      "root_id": "platform"
    },
    "billing": {
      "amount": "0.02",
      "currency": "USD",
      "balance_after": "9.98"
    }
  }
}

取自 2026-10-10 12:46 UTC 录下的真实返回。名字、正文和编号是示例,链接也是,都不是录到的原文(页面不展示任何人的个人信息);数字是原样。长列表做了截断。请求号、游标和余额是示意。

小红书笔记详情 · $0.0200 / 一次 · 参数、字段和报错见接口页 →

示例花多少钱

翻 3 页搜索结果,再取其中 10 篇笔记的完整内容

接口调用次数单价小计
小红书笔记搜索3$0.0200$0.0600
小红书笔记详情10$0.0200$0.20
合计13$0.26

价格是生成本页时的现行价格。失败的调用不收费。

在 AI 里做(MCP)

把 OneFeedAPI 接进你的 AI 客户端,只要接一次。之后直接说要什么,代理自己找到这些接口、看好价格,用你的余额调用。

这样说: 在小红书搜“咖啡”,翻 3 页,再取前 10 篇笔记的完整正文和话题标签,整理成一张表。
代理发给 call 工具的参数
{
  "capability": "xiaohongshu.notes.search",
  "query": "咖啡",
  "idempotency_key": "<a new UUID>"
}

登录后复制带你 Key 的接入提示词了解 MCP 服务 →

用 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-Key 24 小时内不重复扣费。
  • 接 AI 方便:远程 MCP 服务已在 MCP 官方登记处登记(com.onefeedapi/mcp),Claude、Cursor、ChatGPT 都能直接用。
  • 免费试用,最多 333 次,不用绑卡。

要知道的

  • 搜索一页最多 20 条。平台夹在结果里的广告不是笔记,会被去掉,所以一页可能不满 20 条。page.next_cursor 一小时内有效。
  • 搜索结果里没有作者粉丝数和话题标签;两个接口都没有浏览数(metrics.views),这类字段写在 meta.unavailable 里。
  • 笔记详情只收笔记编号或网页长链接,短链接和分享口令不收。
  • 用命令行导出最省事:onefeedapi call 加 --pages 连翻几页(每页单独计费,--max-spend 限定总花费),加 --out 把结果写成 JSON 文件。