Skip to content

抖音视频评论 API (V1) ​

GET
接口健康状态
健康 可用 少量可用 基本不可用 暂无数据
正在加载健康状态…

通过aweme ID以分页方式获取抖音视频的顶级评论。用于查看观众反馈或分析已知视频的讨论。

请求参数 ​

参数名位置类型必填默认值说明
tokenquerystring是-此 API 服务的访问令牌。
awemeIdquerystring是-视频唯一标识符(aweme_id)。
pagequeryinteger否1页码(从1开始)。

代码示例 ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/douyin/get-video-comment/v1?token=YOUR_API_KEY&awemeId=VALUE'
text
我想使用 JustOneAPI 提供的“视频评论 (V1)”接口。
接入地址: https://api.justoneapi.com。
接口路径: /api/douyin/get-video-comment/v1?token=YOUR_API_KEY&awemeId=VALUE
接口地址: BASE_URL + /api/douyin/get-video-comment/v1?token=YOUR_API_KEY&awemeId=VALUE
HTTP 方法: GET
身份验证: 在 URL 中传入 token 查询参数。
OpenAPI 定义: https://docs.justoneapi.com/openapi/douyin-tiktok-china/video-comments-v1-zh.json

请求参数说明:
- token (query): 此 API 服务的访问令牌。 (必填)
- awemeId (query): 视频唯一标识符(aweme_id)。 (必填)
- page (query): 页码(从1开始)。

返回格式: 请根据实际 Content-Type 安全处理 JSON 或文本响应。

响应处理与错误码:
1. 需通过返回体中的 "code" 字段判断业务结果(code 为 0 表示成功)。
2. 超时建议:建议将请求超时时间设置为 120 秒;如果 120 秒偏长,请至少设置为 60 秒,但可能会有少量请求因超时而未接收到结果。
3. 业务码说明:
   - 0: 成功
   - 100: Token 无效或已失效
   - 301: 采集失败,请重试
   - 302: 超出速率限制
   - 303: 超出每日配额
   - 400: 参数错误
   - 500: 内部服务器错误
   - 600: 权限不足
   - 601: 账户余额不足
   - 602: TOKEN 限额超限
4. code 601 表示账户共享余额不足。code 602 表示当前 API TOKEN 自身的累计消费上限已达到。TOKEN 限额不是资金划拨,多个 TOKEN 仍共享同一个账户余额。

请帮我用我擅长的编程语言写一个脚本来调用这个接口,并处理返回结果。
python
import requests

BASE_URL = "https://api.justoneapi.com"  # 由 OpenAPI servers 提供

url = BASE_URL + "/api/douyin/get-video-comment/v1?token=YOUR_API_KEY&awemeId=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
    content_type = response.headers.get("content-type", "").lower()
    if "json" in content_type:
        try:
            print(response.json())
        except ValueError:
            print(response.text)
    elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
        print(response.text)
    else:
        with open("response.bin", "wb") as output:
            output.write(response.content)
        print(f"Saved {len(response.content)} bytes to response.bin")
js
const BASE_URL = "https://api.justoneapi.com"; // 由 OpenAPI servers 提供
const url = BASE_URL + "/api/douyin/get-video-comment/v1?token=YOUR_API_KEY&awemeId=VALUE";

const response = await fetch(url, {
  method: "GET",
  signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
  const contentType = (response.headers.get("content-type") || "").toLowerCase();
  const mediaType = contentType.split(";", 1)[0].trim();
  const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
  if (textual) {
    const responseText = new TextDecoder().decode(responseBytes);
    let data = responseText;
    if (contentType.includes("json")) {
      try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
    }
    console.log(data);
  } else {
    console.log(`Received ${responseBytes.byteLength} binary bytes`);
  }
}
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static void main(String[] args) throws Exception {
        final String BASE_URL = "https://api.justoneapi.com"; // 由 OpenAPI servers 提供
        final String url = BASE_URL + "/api/douyin/get-video-comment/v1?token=YOUR_API_KEY&awemeId=VALUE";

        HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
        HttpRequest.Builder builder = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .timeout(Duration.ofSeconds(120))
            .method("GET", HttpRequest.BodyPublishers.noBody());

        HttpRequest request = builder.build();

        HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
        System.out.println(response.statusCode());
        String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
        String mediaType = contentType.split(";", 2)[0].trim();
        if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
            System.out.println(new String(response.body(), StandardCharsets.UTF_8));
        } else {
            Files.write(Path.of("response.bin"), response.body());
            System.out.println("Saved " + response.body().length + " bytes to response.bin");
        }
    }
}
go
package main

import (
	"fmt"
	"io"
	"os"
	"strings"
	"net/http"
	"time"
)

const BASE_URL = "https://api.justoneapi.com" // 由 OpenAPI servers 提供

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/douyin/get-video-comment/v1?token=YOUR_API_KEY&awemeId=VALUE"
	req, _ := http.NewRequest("GET", url, nil)
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	fmt.Println(resp.StatusCode)
	bodyBytes, _ := io.ReadAll(resp.Body)
	contentType := strings.ToLower(resp.Header.Get("Content-Type"))
	mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
	if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
		fmt.Println(string(bodyBytes))
	} else {
		os.WriteFile("response.bin", bodyBytes, 0600)
		fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
	}
}
php
<?php
$BASE_URL = 'https://api.justoneapi.com'; // 由 OpenAPI servers 提供
$url = $BASE_URL . '/api/douyin/get-video-comment/v1?token=YOUR_API_KEY&awemeId=VALUE';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
    echo $response;
} else {
    file_put_contents('response.bin', $response);
    echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}

返回字段 ​

业务成功时(code = 0)的主要返回字段。

评论概览7 个字段

data.comments[]

作品下的一条一级评论。

字段类型说明
cidstring评论 ID,以文本返回。
aweme_idstring评论关联的抖音作品 ID,以文本返回。
textstring评论文本。含媒体的评论文本可以为空。
create_timeinteger评论发布时间,Unix 时间戳(秒)。
ip_labelstring评论展示的 IP 属地标签,可能不返回。
content_typeinteger该评论返回的数值型内容类型代码。
statusinteger该评论返回的数值型状态代码。
互动与标签13 个字段

data.comments[]

字段类型说明
digg_countinteger这条评论报告的点赞数。
is_hotboolean是否标记为热门评论。
is_foldedboolean是否标记为折叠评论。
is_author_diggedboolean作品作者是否给这条评论点赞。
user_diggedinteger当前展示上下文报告的数值型点赞状态。
can_collectboolean回包是否标记这条评论可收藏。
can_shareboolean回包是否标记这条评论可分享。
label_textstring评论标签的显示文本,可能为空。
label_typeinteger评论标签返回的数值型类型代码。
label_listarray | null随评论返回的标签列表,字段可能为 null。
label_list[]object评论上的一个标签。
label_list[].typeinteger评论标签返回的数值型类型代码。
label_list[].textstring该标签的展示文本。
评论作者17 个字段

data.comments[].user

评论作者的公开账号信息。

字段类型说明
uidstring抖音账号 ID,以文本返回。
sec_uidstring抖音个人主页链接使用的公开账号标识。
short_idstring抖音返回的账号短标识。
unique_idstring公开的抖音号,可能为空。
nicknamestring评论作者的展示名称。
avatar_thumbobject头像缩略图资源。
avatar_thumb.uristring该资源在平台中的标识。
avatar_thumb.url_listarray该资源返回的链接列表。
avatar_thumb.url_list[]string该资源的一个链接。
avatar_thumb.widthinteger该资源报告的宽度,单位为像素。
avatar_thumb.heightinteger该资源报告的高度,单位为像素。
avatar_mediumobject中等尺寸的头像资源。
avatar_medium.uristring该资源在平台中的标识。
avatar_medium.url_listarray该资源返回的链接列表。
avatar_medium.url_list[]string该资源的一个链接。
avatar_medium.widthinteger该资源报告的宽度,单位为像素。
avatar_medium.heightinteger该资源报告的高度,单位为像素。
预览回复26 个字段

data.comments[]

字段类型说明
reply_comment_totalinteger这条评论报告的回复数。返回的预览回复可能只涵盖其中一部分。
reply_idstring回包报告的父评论 ID。一级评论可返回“0”。
reply_to_reply_idstring回包报告的楼中楼回复对象 ID,可以为“0”。
reply_commentarray | null随评论返回的可选预览回复。查看分页回复列表请使用评论回复接口。
reply_comment[]object评论预览中的一条回复。
reply_comment[].cidstring评论 ID,以文本返回。
reply_comment[].aweme_idstring评论关联的抖音作品 ID,以文本返回。
reply_comment[].textstring评论文本。含媒体的评论文本可以为空。
reply_comment[].create_timeinteger评论发布时间,Unix 时间戳(秒)。
reply_comment[].digg_countinteger这条评论报告的点赞数。
reply_comment[].reply_idstring回包报告的父评论 ID。一级评论可返回“0”。
reply_comment[].reply_to_reply_idstring回包报告的楼中楼回复对象 ID,可以为“0”。
reply_comment[].is_author_diggedboolean作品作者是否给这条评论点赞。
reply_comment[].label_textstring评论标签的显示文本,可能为空。
reply_comment[].userobject回复作者的公开账号信息。
reply_comment[].user.uidstring抖音账号 ID,以文本返回。
reply_comment[].user.sec_uidstring抖音个人主页链接使用的公开账号标识。
reply_comment[].user.short_idstring抖音返回的账号短标识。
reply_comment[].user.unique_idstring公开的抖音号,可能为空。
reply_comment[].user.nicknamestring评论作者的展示名称。
reply_comment[].user.avatar_thumbobject头像缩略图资源。
reply_comment[].user.avatar_thumb.uristring该资源在平台中的标识。
reply_comment[].user.avatar_thumb.url_listarray该资源返回的链接列表。
reply_comment[].user.avatar_thumb.url_list[]string该资源的一个链接。
reply_comment[].user.avatar_thumb.widthinteger该资源报告的宽度,单位为像素。
reply_comment[].user.avatar_thumb.heightinteger该资源报告的高度,单位为像素。
评论图片32 个字段

data.comments[]

字段类型说明
image_listarray | null这条评论附带的图片,字段可能为 null。
image_list[]object一张图片及其可用版本。
image_list[].origin_urlobject原图版本。
image_list[].origin_url.uristring该资源在平台中的标识。
image_list[].origin_url.url_listarray该资源返回的链接列表。
image_list[].origin_url.url_list[]string该资源的一个链接。
image_list[].origin_url.widthinteger该资源报告的宽度,单位为像素。
image_list[].origin_url.heightinteger该资源报告的高度,单位为像素。
image_list[].crop_urlobject裁剪图版本。
image_list[].crop_url.uristring该资源在平台中的标识。
image_list[].crop_url.url_listarray该资源返回的链接列表。
image_list[].crop_url.url_list[]string该资源的一个链接。
image_list[].crop_url.widthinteger该资源报告的宽度,单位为像素。
image_list[].crop_url.heightinteger该资源报告的高度,单位为像素。
image_list[].thumb_urlobject缩略图版本。
image_list[].thumb_url.uristring该资源在平台中的标识。
image_list[].thumb_url.url_listarray该资源返回的链接列表。
image_list[].thumb_url.url_list[]string该资源的一个链接。
image_list[].thumb_url.widthinteger该资源报告的宽度,单位为像素。
image_list[].thumb_url.heightinteger该资源报告的高度,单位为像素。
image_list[].medium_urlobject中等尺寸图片版本。
image_list[].medium_url.uristring该资源在平台中的标识。
image_list[].medium_url.url_listarray该资源返回的链接列表。
image_list[].medium_url.url_list[]string该资源的一个链接。
image_list[].medium_url.widthinteger该资源报告的宽度,单位为像素。
image_list[].medium_url.heightinteger该资源报告的高度,单位为像素。
image_list[].download_urlobject列出的下载用图片资源。
image_list[].download_url.uristring该资源在平台中的标识。
image_list[].download_url.url_listarray该资源返回的链接列表。
image_list[].download_url.url_list[]string该资源的一个链接。
image_list[].download_url.widthinteger该资源报告的宽度,单位为像素。
image_list[].download_url.heightinteger该资源报告的高度,单位为像素。
贴纸20 个字段

data.comments[]

字段类型说明
stickerobject评论附带的贴纸,可能不返回。
sticker.idinteger数值型贴纸 ID。
sticker.id_strstring贴纸 ID 的文本形式。
sticker.author_sec_uidstring贴纸作者的抖音公开账号标识。
sticker.origin_package_idinteger贴纸所属的原始贴纸包 ID。
sticker.sticker_typeinteger贴纸返回的数值型类型代码。
sticker.widthinteger该资源报告的宽度,单位为像素。
sticker.heightinteger该资源报告的高度,单位为像素。
sticker.static_urlobject静态贴纸资源。
sticker.static_url.uristring该资源在平台中的标识。
sticker.static_url.url_listarray该资源返回的链接列表。
sticker.static_url.url_list[]string该资源的一个链接。
sticker.static_url.widthinteger该资源报告的宽度,单位为像素。
sticker.static_url.heightinteger该资源报告的高度,单位为像素。
sticker.animate_urlobject动态贴纸资源。
sticker.animate_url.uristring该资源在平台中的标识。
sticker.animate_url.url_listarray该资源返回的链接列表。
sticker.animate_url.url_list[]string该资源的一个链接。
sticker.animate_url.widthinteger该资源报告的宽度,单位为像素。
sticker.animate_url.heightinteger该资源报告的高度,单位为像素。
文本标注7 个字段

data.comments[]

字段类型说明
text_extraarray与评论文本关联的标注,例如提及其他用户。
text_extra[]object评论文本中的一处标注。
text_extra[].typeinteger文本标注返回的数值型类型代码。
text_extra[].startinteger标注在评论文本中的起始位置。
text_extra[].endinteger标注在评论文本中的结束位置。
text_extra[].user_idstring此标注关联的抖音账号 ID,以文本返回。
text_extra[].sec_uidstring此标注关联的抖音公开账号标识。
分页与响应8 个字段

data

所查询抖音作品的一页一级评论。

字段类型说明
commentsarray | null当前页的一级评论。空页可以返回 null。不同页可能出现重复评论,可按 cid 去重。
comments[].item_comment_totalinteger随这条评论返回的作品评论总数。
status_codeinteger评论页返回的业务状态代码。
cursorinteger回包报告的分页位置。继续翻页时递增请求参数 page。
has_moreinteger分页标记。1 表示报告还有下一页,0 表示翻页结束。
totalinteger当前页报告的评论总数,可以与跨页去重后取得的评论数不同。空页可以报告 0。
extraobject评论页附带的时间信息。
extra.nowinteger回包报告的响应时间,Unix 时间戳(毫秒)。

响应示例 ​

正在加载响应示例…