跳至主要內容

抖音評論回覆 API (V1) ​

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

通過分頁方式獲取抖音視頻頂級評論的回覆。用於檢查線索討論並查看已知評論下的反饋。

請求參數 ​

參數名 位置 類型 必填 預設值 說明
token query string 是 - 此 API 服務的訪問令牌。
commentId query string 是 - 頂級評論的唯一標識符。
page query integer 否 1 頁碼(從1開始)。

程式碼範例 ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/douyin/get-video-sub-comment/v1?token=YOUR_API_KEY&commentId=VALUE'
text
我想使用 JustOneAPI 提供的“評論回覆 (V1)”接口。
接入地址: https://api.justoneapi.com。
接口路徑: /api/douyin/get-video-sub-comment/v1?token=YOUR_API_KEY&commentId=VALUE
接口地址: BASE_URL + /api/douyin/get-video-sub-comment/v1?token=YOUR_API_KEY&commentId=VALUE
HTTP 方法: GET
身份驗證: 在 URL 中傳入 token 查詢參數。
OpenAPI 定義: https://docs.justoneapi.com/openapi/douyin-tiktok-china/comment-replies-v1-zh-hant.json

請求參數說明:
- token (query): 此 API 服務的訪問令牌。 (必填)
- commentId (query): 頂級評論的唯一標識符。 (必填)
- 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-sub-comment/v1?token=YOUR_API_KEY&commentId=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-sub-comment/v1?token=YOUR_API_KEY&commentId=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-sub-comment/v1?token=YOUR_API_KEY&commentId=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-sub-comment/v1?token=YOUR_API_KEY&commentId=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-sub-comment/v1?token=YOUR_API_KEY&commentId=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)的主要返回欄位。

結果與分頁6 個欄位

data

指定抖音一級評論下的一頁回覆。

欄位 類型 說明
status_code integer 抖音回覆資料內部的平台狀態碼。
cursor integer 本頁回覆返回的數字游標。請求某一頁時使用 page 參數。
has_more integer 是否還有回覆續頁的數字標記。實測 1 表示還有後續頁,0 表示已到末頁。
total integer 指定評論返回的回覆總數。
comments array | null 本頁回覆列表。成功回應沒有回覆時,可能返回 null。
comments[] object 指定一級評論下的一條回覆。
回覆內容與互動12 個欄位

data.comments[]

欄位 類型 說明
cid string 這條回覆評論的 ID,以字符串返回。
aweme_id string 評論線程所在的抖音作品 ID。
text string 回覆評論的正文。
create_time integer 回覆發佈時間,以 Unix 秒級時間戳返回。
digg_count integer 回覆返回的點贊數。
status integer 回覆返回的數字狀態代碼。
level integer 回覆返回的嵌套層級。
comment_reply_total integer 該評論條目返回的回覆數量。
is_hot boolean 抖音是否將該回復標記為熱門。
is_folded boolean 抖音是否將該回復標記為摺疊。
is_author_digged boolean 抖音是否將該回復標記為獲作者點贊。
content_type integer 回覆返回的數字內容類型代碼。
回覆關係5 個欄位

data.comments[]

欄位 類型 說明
reply_id string 一級評論 ID,對應請求參數 commentId。
reply_to_reply_id string 這條回覆指向的另一條回覆 ID。字符串 0 可表示沒有指定的回覆對象。
reply_to_username string 被回覆用戶的展示名稱,有資料時返回。
reply_to_userid string 被回覆用戶的抖音 ID,有資料時返回。
reply_to_user_sec_id string 被回覆用戶的不透明抖音標識,有資料時返回。
回覆作者45 個欄位

data.comments[]

欄位 類型 說明
user object 回覆作者的公開主頁信息。
user.uid string 回覆作者的抖音用戶 ID,以文本返回。
user.sec_uid string 回覆作者對應的不透明抖音用戶標識。
user.short_id string 作者返回的短帳號 ID。
user.unique_id string 作者返回的公開帳號名。
user.nickname string 回覆作者的展示暱稱。
user.avatar_thumb object 縮略頭像信息。
user.avatar_thumb.uri string 抖音返回的媒體資源標識。
user.avatar_thumb.url_list array 媒體資源連結,數組可能為空。
user.avatar_thumb.url_list[] string 該媒體資源的一條連結。
user.avatar_thumb.width integer 媒體資源返回的寬度。
user.avatar_thumb.height integer 媒體資源返回的高度。
user.avatar_medium object 中等尺寸頭像信息。
user.avatar_medium.uri string 抖音返回的媒體資源標識。
user.avatar_medium.url_list array 媒體資源連結,數組可能為空。
user.avatar_medium.url_list[] string 該媒體資源的一條連結。
user.avatar_medium.width integer 媒體資源返回的寬度。
user.avatar_medium.height integer 媒體資源返回的高度。
user.avatar_larger object 較大尺寸頭像信息。
user.avatar_larger.uri string 抖音返回的媒體資源標識。
user.avatar_larger.url_list array 媒體資源連結,數組可能為空。
user.avatar_larger.width integer 媒體資源返回的寬度。
user.avatar_larger.height integer 媒體資源返回的高度。
user.avatar_168x168 object 168×168 規格欄位對應的頭像信息。
user.avatar_168x168.uri string 抖音返回的媒體資源標識。
user.avatar_168x168.url_list array 媒體資源連結,數組可能為空。
user.avatar_168x168.width integer 媒體資源返回的寬度。
user.avatar_168x168.height integer 媒體資源返回的高度。
user.avatar_300x300 object 300×300 規格欄位對應的頭像信息。
user.avatar_300x300.uri string 抖音返回的媒體資源標識。
user.avatar_300x300.url_list array 媒體資源連結,數組可能為空。
user.avatar_300x300.width integer 媒體資源返回的寬度。
user.avatar_300x300.height integer 媒體資源返回的高度。
user.is_verified boolean 作者是否標記為已認證。
user.verification_type integer 作者返回的數字認證類型代碼。
user.custom_verify string 作者返回的認證展示文字。
user.enterprise_verify_reason string 作者返回的企業認證說明。
user.aweme_count integer 平台返回的作者發帖數量。
user.follower_count integer 平台返回的作者粉絲數。
user.follower_count_str string 作者粉絲數的展示文本。
user.following_count integer 作者關注的帳號數量。
user.favoriting_count integer 作者信息返回的已點贊內容數量。
user.total_favorited integer 抖音返回的作者獲贊總數。
user.room_id integer 作者返回的數字直播間標識,有資料時提供。
user.room_id_str string 直播間標識的文本形式。
文本標記與標籤15 個欄位

data.comments[]

欄位 類型 說明
text_extra array 回覆文本附帶的提及或話題信息,數組可能為空。
text_extra[] object 回覆文本中一段內容的附加信息。
text_extra[].start integer 抖音返回的文本實體起始偏移量。
text_extra[].end integer 抖音返回的文本實體結束偏移量。
text_extra[].type integer 文本實體的數字類型代碼。
text_extra[].user_id string 文本實體對應的用戶標識,有資料時提供。
text_extra[].sec_uid string 文本實體對應的不透明抖音用戶標識,有資料時提供。
text_extra[].hashtag_id string 文本實體對應的話題標識,有資料時提供。
text_extra[].hashtag_name string 文本實體對應的話題展示名稱。
label_text string 回覆附帶的展示標籤,可能為空字符串。
label_type integer 回覆展示標籤的數字類型代碼。
label_list array | null 回覆附帶的展示標籤,以數組或 null 返回。
label_list[] object 回覆上的一項展示標籤。
label_list[].type integer 回覆標籤的數字類型。
label_list[].text string 回覆標籤的展示文字。
貼紙19 個欄位

data.comments[]

欄位 類型 說明
sticker object 回覆中返回的貼紙附件,有資料時提供。
sticker.id integer 以整數返回的貼紙標識。
sticker.id_str string 以文本返回的貼紙標識。
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 媒體資源返回的高度。
sticker.sticker_type integer 貼紙返回的數值型類型代碼。
sticker.origin_package_id integer 原始貼紙包標識。

回應示例 ​

正在載入回應範例…