跳至主要內容

抖音視頻評論 API (V1) ​

GET
API 端點健康狀態
健康 可用 少量可用 基本不可用 暫無資料
正在載入健康狀態…

通過aweme ID以分頁方式獲取抖音視頻的頂級評論。用於查看觀衆反饋或分析已知視頻的討論。

請求參數 ​

參數名 位置 類型 必填 預設值 說明
token query string 是 - 此 API 服務的訪問令牌。
awemeId query string 是 - 視頻唯一標識符(aweme_id)。
page query integer 否 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-hant.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[]

作品下的一條一級評論。

欄位 類型 說明
cid string 評論 ID,以文本返回。
aweme_id string 評論關聯的抖音作品 ID,以文本返回。
text string 評論文本。含媒體的評論文本可以為空。
create_time integer 評論發佈時間,Unix 時間戳(秒)。
ip_label string 評論展示的 IP 屬地標籤,可能不返回。
content_type integer 該評論返回的數值型內容類型代碼。
status integer 該評論返回的數值型狀態代碼。
互動與標籤13 個欄位

data.comments[]

欄位 類型 說明
digg_count integer 這條評論報告的點贊數。
is_hot boolean 是否標記為熱門評論。
is_folded boolean 是否標記為摺疊評論。
is_author_digged boolean 作品作者是否給這條評論點贊。
user_digged integer 當前展示上下文報告的數值型點贊狀態。
can_collect boolean 回包是否標記這條評論可收藏。
can_share boolean 回包是否標記這條評論可分享。
label_text string 評論標籤的顯示文本,可能為空。
label_type integer 評論標籤返回的數值型類型代碼。
label_list array | null 隨評論返回的標籤列表,欄位可能為 null。
label_list[] object 評論上的一個標籤。
label_list[].type integer 評論標籤返回的數值型類型代碼。
label_list[].text string 該標籤的展示文本。
評論作者17 個欄位

data.comments[].user

評論作者的公開帳號信息。

欄位 類型 說明
uid string 抖音帳號 ID,以文本返回。
sec_uid string 抖音個人主頁連結使用的公開帳號標識。
short_id string 抖音返回的帳號短標識。
unique_id string 公開的抖音號,可能為空。
nickname string 評論作者的展示名稱。
avatar_thumb object 頭像縮略圖資源。
avatar_thumb.uri string 該資源在平台中的標識。
avatar_thumb.url_list array 該資源返回的連結列表。
avatar_thumb.url_list[] string 該資源的一個連結。
avatar_thumb.width integer 該資源報告的寬度,單位為像素。
avatar_thumb.height integer 該資源報告的高度,單位為像素。
avatar_medium object 中等尺寸的頭像資源。
avatar_medium.uri string 該資源在平台中的標識。
avatar_medium.url_list array 該資源返回的連結列表。
avatar_medium.url_list[] string 該資源的一個連結。
avatar_medium.width integer 該資源報告的寬度,單位為像素。
avatar_medium.height integer 該資源報告的高度,單位為像素。
預覽回覆26 個欄位

data.comments[]

欄位 類型 說明
reply_comment_total integer 這條評論報告的回覆數。返回的預覽回覆可能只涵蓋其中一部分。
reply_id string 回包報告的父評論 ID。一級評論可返回“0”。
reply_to_reply_id string 回包報告的樓中樓回覆對象 ID,可以為“0”。
reply_comment array | null 隨評論返回的可選預覽回覆。查看分頁回覆列表請使用評論回覆接口。
reply_comment[] object 評論預覽中的一條回覆。
reply_comment[].cid string 評論 ID,以文本返回。
reply_comment[].aweme_id string 評論關聯的抖音作品 ID,以文本返回。
reply_comment[].text string 評論文本。含媒體的評論文本可以為空。
reply_comment[].create_time integer 評論發佈時間,Unix 時間戳(秒)。
reply_comment[].digg_count integer 這條評論報告的點贊數。
reply_comment[].reply_id string 回包報告的父評論 ID。一級評論可返回“0”。
reply_comment[].reply_to_reply_id string 回包報告的樓中樓回覆對象 ID,可以為“0”。
reply_comment[].is_author_digged boolean 作品作者是否給這條評論點贊。
reply_comment[].label_text string 評論標籤的顯示文本,可能為空。
reply_comment[].user object 回覆作者的公開帳號信息。
reply_comment[].user.uid string 抖音帳號 ID,以文本返回。
reply_comment[].user.sec_uid string 抖音個人主頁連結使用的公開帳號標識。
reply_comment[].user.short_id string 抖音返回的帳號短標識。
reply_comment[].user.unique_id string 公開的抖音號,可能為空。
reply_comment[].user.nickname string 評論作者的展示名稱。
reply_comment[].user.avatar_thumb object 頭像縮略圖資源。
reply_comment[].user.avatar_thumb.uri string 該資源在平台中的標識。
reply_comment[].user.avatar_thumb.url_list array 該資源返回的連結列表。
reply_comment[].user.avatar_thumb.url_list[] string 該資源的一個連結。
reply_comment[].user.avatar_thumb.width integer 該資源報告的寬度,單位為像素。
reply_comment[].user.avatar_thumb.height integer 該資源報告的高度,單位為像素。
評論圖片32 個欄位

data.comments[]

欄位 類型 說明
image_list array | null 這條評論附帶的圖片,欄位可能為 null。
image_list[] object 一張圖片及其可用版本。
image_list[].origin_url object 原圖版本。
image_list[].origin_url.uri string 該資源在平台中的標識。
image_list[].origin_url.url_list array 該資源返回的連結列表。
image_list[].origin_url.url_list[] string 該資源的一個連結。
image_list[].origin_url.width integer 該資源報告的寬度,單位為像素。
image_list[].origin_url.height integer 該資源報告的高度,單位為像素。
image_list[].crop_url object 裁剪圖版本。
image_list[].crop_url.uri string 該資源在平台中的標識。
image_list[].crop_url.url_list array 該資源返回的連結列表。
image_list[].crop_url.url_list[] string 該資源的一個連結。
image_list[].crop_url.width integer 該資源報告的寬度,單位為像素。
image_list[].crop_url.height integer 該資源報告的高度,單位為像素。
image_list[].thumb_url object 縮略圖版本。
image_list[].thumb_url.uri string 該資源在平台中的標識。
image_list[].thumb_url.url_list array 該資源返回的連結列表。
image_list[].thumb_url.url_list[] string 該資源的一個連結。
image_list[].thumb_url.width integer 該資源報告的寬度,單位為像素。
image_list[].thumb_url.height integer 該資源報告的高度,單位為像素。
image_list[].medium_url object 中等尺寸圖片版本。
image_list[].medium_url.uri string 該資源在平台中的標識。
image_list[].medium_url.url_list array 該資源返回的連結列表。
image_list[].medium_url.url_list[] string 該資源的一個連結。
image_list[].medium_url.width integer 該資源報告的寬度,單位為像素。
image_list[].medium_url.height integer 該資源報告的高度,單位為像素。
image_list[].download_url object 列出的下載用圖片資源。
image_list[].download_url.uri string 該資源在平台中的標識。
image_list[].download_url.url_list array 該資源返回的連結列表。
image_list[].download_url.url_list[] string 該資源的一個連結。
image_list[].download_url.width integer 該資源報告的寬度,單位為像素。
image_list[].download_url.height integer 該資源報告的高度,單位為像素。
貼紙20 個欄位

data.comments[]

欄位 類型 說明
sticker object 評論附帶的貼紙,可能不返回。
sticker.id integer 數值型貼紙 ID。
sticker.id_str string 貼紙 ID 的文本形式。
sticker.author_sec_uid string 貼紙作者的抖音公開帳號標識。
sticker.origin_package_id integer 貼紙所屬的原始貼紙包 ID。
sticker.sticker_type integer 貼紙返回的數值型類型代碼。
sticker.width integer 該資源報告的寬度,單位為像素。
sticker.height integer 該資源報告的高度,單位為像素。
sticker.static_url object 靜態貼紙資源。
sticker.static_url.uri string 該資源在平台中的標識。
sticker.static_url.url_list array 該資源返回的連結列表。
sticker.static_url.url_list[] string 該資源的一個連結。
sticker.static_url.width integer 該資源報告的寬度,單位為像素。
sticker.static_url.height integer 該資源報告的高度,單位為像素。
sticker.animate_url object 動態貼紙資源。
sticker.animate_url.uri string 該資源在平台中的標識。
sticker.animate_url.url_list array 該資源返回的連結列表。
sticker.animate_url.url_list[] string 該資源的一個連結。
sticker.animate_url.width integer 該資源報告的寬度,單位為像素。
sticker.animate_url.height integer 該資源報告的高度,單位為像素。
文本標註7 個欄位

data.comments[]

欄位 類型 說明
text_extra array 與評論文本關聯的標註,例如提及其他用戶。
text_extra[] object 評論文本中的一處標註。
text_extra[].type integer 文本標註返回的數值型類型代碼。
text_extra[].start integer 標註在評論文本中的起始位置。
text_extra[].end integer 標註在評論文本中的結束位置。
text_extra[].user_id string 此標註關聯的抖音帳號 ID,以文本返回。
text_extra[].sec_uid string 此標註關聯的抖音公開帳號標識。
分頁與回應8 個欄位

data

所查詢抖音作品的一頁一級評論。

欄位 類型 說明
comments array | null 當前頁的一級評論。空頁可以返回 null。不同頁可能出現重複評論,可按 cid 去重。
comments[].item_comment_total integer 隨這條評論返回的作品評論總數。
status_code integer 評論頁返回的業務狀態代碼。
cursor integer 回包報告的分頁位置。繼續翻頁時遞增請求參數 page。
has_more integer 分頁標記。1 表示報告還有下一頁,0 表示翻頁結束。
total integer 當前頁報告的評論總數,可以與跨頁去重後取得的評論數不同。空頁可以報告 0。
extra object 評論頁附帶的時間信息。
extra.now integer 回包報告的回應時間,Unix 時間戳(毫秒)。

回應示例 ​

正在載入回應範例…