Skip to content

小红书 API - 评论回复 (V2)

prod-global
GET
/api/xiaohongshu/get-note-sub-comment/v2

获取小红书特定评论下的回复(也称为二级评论),支持分页。响应包含回复文本、发布时间、回复者信息(如可用)及其他元数据。

典型使用场景:

  • 通过包含评论线程进行深度情感分析
  • 监控关键评论下的讨论
  • 收集回复线程用于分析、报告和数据集构建

请求参数

参数名位置类型必填说明
tokenquerystring此 API 服务的访问令牌。
noteIdquerystring小红书笔记唯一标识符。
commentIdquerystring小红书唯一评论标识符。
lastCursorquerystring上一页的分页游标(使用上一次响应返回的游标值)。

代码示例

💡 环境说明

默认示例使用 https://api.justoneapi.com (prod-global)。中国大陆地区建议替换为 http://47.117.133.51:30015 (prod-cn) 以获得更好的访问体验。详见 环境选择

bash
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
curl -X GET "https://api.justoneapi.com/api/xiaohongshu/get-note-sub-comment/v2?token=YOUR_API_KEY&noteId=VALUE&commentId=VALUE"
text
我想使用 Just One API 提供的“评论回复 (V2)”接口。
接口地址: https://api.justoneapi.com/api/xiaohongshu/get-note-sub-comment/v2
HTTP 方法: GET
身份验证: 在 URL 后添加查询参数“?token=您的API密钥”。
OpenAPI 定义: https://docs.justoneapi.com/openapi/xiaohongshu-apis/comment-replies-v2-zh.json

请求参数说明:
- token (query): 此 API 服务的访问令牌。 (必填)
- noteId (query): 小红书笔记唯一标识符。 (必填)
- commentId (query): 小红书唯一评论标识符。 (必填)
- lastCursor (query): 上一页的分页游标(使用上一次响应返回的游标值)。

返回格式: JSON

响应处理与错误码:
1. 需通过返回体中的 "code" 字段判断业务结果(code 为 0 表示成功)。
2. 超时建议:建议将请求超时时间设置为至少 60 秒。
3. 业务码说明:
   - 0: 成功
   - 100: Token 无效或已失效
   - 301: 采集失败,请重试
   - 302: 超出速率限制
   - 303: 超出每日配额
   - 400: 参数错误
   - 500: 内部服务器错误
   - 600: 权限不足
   - 601: 余额不足

请帮我用我擅长的编程语言写一个脚本来调用这个接口,并处理返回结果。
python
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import requests

url = "https://api.justoneapi.com/api/xiaohongshu/get-note-sub-comment/v2?token=YOUR_API_KEY&noteId=VALUE&commentId=VALUE"
response = requests.get(url)
print(response.json())
js
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
const response = await fetch("https://api.justoneapi.com/api/xiaohongshu/get-note-sub-comment/v2?token=YOUR_API_KEY&noteId=VALUE&commentId=VALUE", {
  method: "GET"
});
const data = await response.json();
console.log(data);
java
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.justoneapi.com/api/xiaohongshu/get-note-sub-comment/v2?token=YOUR_API_KEY&noteId=VALUE&commentId=VALUE"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
go
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	client := &http.Client{}
	url := "https://api.justoneapi.com/api/xiaohongshu/get-note-sub-comment/v2?token=YOUR_API_KEY&noteId=VALUE&commentId=VALUE"
	req, _ := http.NewRequest("GET", url, nil)
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
php
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.justoneapi.com/api/xiaohongshu/get-note-sub-comment/v2?token=YOUR_API_KEY&noteId=VALUE&commentId=VALUE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
echo $response;

响应结果

json
{
  "code": 0,
  "data": {
    "comments": [
      {
        "translation_strategy": 10,
        "at_users": [],
        "hidden": false,
        "status": 0,
        "target_comment": {
          "status": 0,
          "user": {
            "ai_agent": false,
            "current_user": "false",
            "userid": "a12faa761c07256b3995501c850d2",
            "nickname": "豪",
            "images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo30rmoae6j2g5g5o6poeg08lrqd2p83no?imageView2/2/w/120/format/jpg",
            "red_id": "9530496503",
            "level": {
              "image": ""
            },
            "additional_tags": {}
          },
          "id": "65bf56d3000000000803f4ec"
        },
        "biz_label": {
          "product_review": false,
          "group_invite": "unknown",
          "rich_text": "unknown"
        },
        "note_id": "65bf5360000000002c03f684",
        "like_count": 161,
        "user": {
          "additional_tags": {},
          "ai_agent": false,
          "current_user": "false",
          "userid": "adde925ab72eafe49a33d345e55b1",
          "nickname": "榴莲在摩天轮",
          "images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo31cnkqt5th20g5nre2evg8uuc9gkjs2g?imageView2/2/w/120/format/jpg",
          "red_id": "371915976",
          "level": {
            "image": ""
          }
        },
        "show_type": "common",
        "collected": false,
        "share_strategy": 0,
        "content": "估计又系个假号[笑哭R]",
        "liked": false,
        "show_tags": [],
        "comment_type": 0,
        "downvoted": false,
        "id": "65bf6392000000000800b405",
        "score": 0,
        "time": 1707041682,
        "friend_liked_msg": "",
        "show_tags_v2": []
      },
      {
        "downvoted": false,
        "share_strategy": 0,
        "at_users": [],
        "hidden": false,
        "target_comment": {
          "id": "65bf6392000000000800b405",
          "status": 0,
          "user": {
            "level": {
              "image": ""
            },
            "additional_tags": {},
            "ai_agent": false,
            "current_user": "false",
            "userid": "adde925ab72eafe49a33d345e55b1",
            "nickname": "榴莲在摩天轮",
            "images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo31cnkqt5th20g5nre2evg8uuc9gkjs2g?imageView2/2/w/120/format/jpg",
            "red_id": "371915976"
          }
        },
        "show_tags": [],
        "like_count": 43,
        "liked": false,
        "collected": false,
        "show_tags_v2": [],
        "translation_strategy": 10,
        "id": "65bf659700000000080142ec",
        "content": "别胡说吧…去年媒体当面采访还问她为什么开小红书,她也说之前答应了粉丝要开的…本人都官宣的号怎么到你这里就变假号了[石化R]",
        "show_type": "common",
        "comment_type": 0,
        "user": {
          "userid": "a93fbcb8b00c551b211be5750632d",
          "nickname": "喜欢唱跳rap写信",
          "images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo316u8dgg50o005odpdq9417mfgt60vuo?imageView2/2/w/120/format/jpg",
          "red_id": "1635985618",
          "level": {
            "image": ""
          },
          "additional_tags": {},
          "ai_agent": false,
          "current_user": "false"
        },
        "friend_liked_msg": "",
        "biz_label": {
          "product_review": false,
          "group_invite": "unknown",
          "rich_text": "unknown"
        },
        "note_id": "65bf5360000000002c03f684",
        "score": 0,
        "status": 0,
        "time": 1707042199
      },
      {
        "friend_liked_msg": "",
        "collected": false,
        "note_id": "65bf5360000000002c03f684",
        "at_users": [],
        "liked": false,
        "show_tags_v2": [],
        "biz_label": {
          "product_review": false,
          "group_invite": "unknown",
          "rich_text": "unknown"
        },
        "share_strategy": 0,
        "content": "你自己搜下有几个咯[微笑R]",
        "like_count": 2,
        "status": 0,
        "target_comment": {
          "id": "65bf659700000000080142ec",
          "status": 0,
          "user": {
            "ai_agent": false,
            "current_user": "false",
            "userid": "a93fbcb8b00c551b211be5750632d",
            "nickname": "喜欢唱跳rap写信",
            "images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo316u8dgg50o005odpdq9417mfgt60vuo?imageView2/2/w/120/format/jpg",
            "red_id": "1635985618",
            "level": {
              "image": ""
            },
            "additional_tags": {}
          }
        },
        "show_type": "common",
        "translation_strategy": 10,
        "downvoted": false,
        "id": "65bf65dc000000000803286b",
        "hidden": false,
        "score": 0,
        "time": 1707042268,
        "user": {
          "ai_agent": false,
          "current_user": "false",
          "userid": "adde925ab72eafe49a33d345e55b1",
          "nickname": "榴莲在摩天轮",
          "images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo31cnkqt5th20g5nre2evg8uuc9gkjs2g?imageView2/2/w/120/format/jpg",
          "red_id": "371915976",
          "level": {
            "image": ""
          },
          "additional_tags": {}
        },
        "show_tags": [],
        "comment_type": 0
      },
      {
        "note_id": "65bf5360000000002c03f684",
        "translation_strategy": 10,
        "downvoted": false,
        "show_tags_v2": [],
        "biz_label": {
          "product_review": false,
          "group_invite": "unknown",
          "rich_text": "unknown"
        },
        "collected": false,
        "hidden": false,
        "time": 1707042303,
        "friend_liked_msg": "",
        "target_comment": {
          "id": "65bf56d3000000000803f4ec",
          "status": 0,
          "user": {
            "ai_agent": false,
            "current_user": "false",
            "userid": "a12faa761c07256b3995501c850d2",
            "nickname": "豪",
            "images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo30rmoae6j2g5g5o6poeg08lrqd2p83no?imageView2/2/w/120/format/jpg",
            "red_id": "9530496503",
            "level": {
              "image": ""
            },
            "additional_tags": {}
          }
        },
        "show_type": "common",
        "id": "65bf65ff000000000803cfe8",
        "like_count": 40,
        "liked": false,
        "status": 0,
        "user": {
          "current_user": "false",
          "userid": "a93fbcb8b00c551b211be5750632d",
          "nickname": "喜欢唱跳rap写信",
          "images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo316u8dgg50o005odpdq9417mfgt60vuo?imageView2/2/w/120/format/jpg",
          "red_id": "1635985618",
          "level": {
            "image": ""
          },
          "additional_tags": {},
          "ai_agent": false
        },
        "show_tags": [],
        "comment_type": 0,
        "share_strategy": 0,
        "content": "她打tag也写了美斯啊…而且正文写梅西没问题吧?迁就内地广东以外的网友",
        "at_users": [],
        "score": 0
      },
      {
        "show_tags_v2": [],
        "downvoted": false,
        "like_count": 7,
        "target_comment": {
          "status": 0,
          "user": {
            "images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo31cnkqt5th20g5nre2evg8uuc9gkjs2g?imageView2/2/w/120/format/jpg",
            "red_id": "371915976",
            "level": {
              "image": ""
            },
            "additional_tags": {},
            "ai_agent": false,
            "current_user": "false",
            "userid": "adde925ab72eafe49a33d345e55b1",
            "nickname": "榴莲在摩天轮"
          },
          "id": "65bf65dc000000000803286b"
        },
        "status": 0,
        "show_type": "common",
        "collected": false,
        "at_users": [],
        "liked": false,
        "user": {
          "level": {
            "image": ""
          },
          "additional_tags": {},
          "ai_agent": false,
          "current_user": "false",
          "userid": "a93fbcb8b00c551b211be5750632d",
          "nickname": "喜欢唱跳rap写信",
          "images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo316u8dgg50o005odpdq9417mfgt60vuo?imageView2/2/w/120/format/jpg",
          "red_id": "1635985618"
        },
        "biz_label": {
          "product_review": false,
          "group_invite": "unknown",
          "rich_text": "unknown"
        },
        "translation_strategy": 10,
        "id": "65bf662f0000000008017f77",
        "time": 1707042351,
        "hidden": false,
        "score": 0,
        "show_tags": [],
        "comment_type": 0,
        "friend_liked_msg": "",
        "share_strategy": 0,
        "note_id": "65bf5360000000002c03f684",
        "content": "拜托她就这一个小红书号…你看到有好几个吗?"
      }
    ],
    "has_more": true,
    "cursor": "{\"cursor\":\"65bf662f0000000008017f77\",\"index\":2}"
  }
}

💡 提示:为简化展示,列表类数据样例仅保留 1-2 条记录,实际返回条数以接口响应为准。