本文へ移動

抖音(TikTok China) 動画検索 API (V4) ​

GET
APIの健康状態
正常 利用可能 限られた数 ほとんど利用できない データなし
健康状態を読み込んでいます...

キーワードでDouyin(TikTok China)動画を検索し、ソート、公開時間、長さ、ページフィルターを使用します。後のページでは、前の検索IDが必要です。コンテンツの発見とトレンドの研究をサポートするために使用します。

パラメータ ​

名前 パラメーターの場所 タイプ 必須 デフォルト 説明
token query string はい - このAPIサービスのアクセストークン。
keyword query string はい - 検索キーワード。
sortType query string いいえ _0 検索結果のソート基準。


利用可能値:

- _0: 一般

- _1: より多くのいいね

- _2: 最新
publishTime query string いいえ _0 動画の公開時間範囲でフィルタリング。


利用可能値:

- _0: 制限なし

- _1: 過去24時間

- _7: 過去7日間

- _180: 過去6ヶ月
duration query string いいえ _0 動画の長さでフィルタリング。


利用可能値:

- _0: 制限なし

- _1: 1分未満

- _2: 1-5分

- _3: 5分以上
page query integer いいえ 1 ページ番号(1から始まる)。
searchId query string いいえ - 検索 ID。page > 1 のリクエストで必須です。直前のレスポンスの data.business_config.next_page.search_id を渡します。data.business_config.has_more が 0 のときは取得を終了します。

コードサンプル ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE'
text
私はJustOneAPIの"動画検索 (V4)" APIを使用したいです。
基本URL: https://api.justoneapi.com.
APIパス: /api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE
APIエンドポイント: BASE_URL + /api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE
HTTPメソッド: GET
認証: "token"クエリパラメーターをURLに追加します。
OpenAPI定義: https://docs.justoneapi.com/openapi/douyin-tiktok-china/video-search-v4-ja.json

パラメーター:
- token (query): このAPIサービスのアクセストークン。 (必須)
- keyword (query): 検索キーワード。 (必須)
- sortType (query): 検索結果のソート基準。

利用可能値:
- `_0`: 一般
- `_1`: より多くのいいね
- `_2`: 最新
- publishTime (query): 動画の公開時間範囲でフィルタリング。

利用可能値:
- `_0`: 制限なし
- `_1`: 過去24時間
- `_7`: 過去7日間
- `_180`: 過去6ヶ月
- duration (query): 動画の長さでフィルタリング。

利用可能値:
- `_0`: 制限なし
- `_1`: 1分未満
- `_2`: 1-5分
- `_3`: 5分以上
- page (query): ページ番号(1から始まる)。
- searchId (query): 検索 ID。page > 1 のリクエストで必須です。直前のレスポンスの data.business_config.next_page.search_id を渡します。data.business_config.has_more が 0 のときは取得を終了します。

返信形式:実際のContent-Typeに応じて、JSONまたはテキストを安全に処理する。

レスポンスの処理とエラーコード:
1. API の処理結果はレスポンス本文の「code」フィールドで判定します。code が 0 なら成功です。
2. 推奨タイムアウト:リクエストのタイムアウトは 120 秒に設定してください。120 秒が長すぎる場合でも、最低 60 秒を確保してください。一部のリクエストは、結果を受け取る前にタイムアウトすることがあります。
3. 処理結果コード:
   - 0: 成功
   - 100: 無効または停止中のトークン
   - 301: データの取得に失敗しました。再試行してください。
   - 302: 呼び出し頻度の上限を超えました
   - 303: 日次の利用上限を超えました
   - 400: パラメーターが無効です
   - 500: サーバー内部エラー
   - 600: アクセス権限がありません
   - 601: 残高不足
   - 602: トークンの予算上限に達しました
4. コード 601 はアカウントの共有残高不足を示します。コード 602 は使用中の API トークン固有の累積予算上限に達したことを示します。トークンに予算上限を設定しても、共有残高から資金が移動することはありません。

お手伝いください。私が好むプログラミング言語でこのAPIを呼び出し、レスポンスを処理するスクリプトを作成してください。
python
import requests

BASE_URL = "https://api.justoneapi.com"  # オープンAPIサーバーによって提供される

url = BASE_URL + "/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=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"; // オープンAPIサーバーによって提供される
const url = BASE_URL + "/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=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"; // オープンAPIサーバーによって提供される
        final String url = BASE_URL + "/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=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" // オープンAPIサーバーによって提供される

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=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'; // オープンAPIサーバーによって提供される
$url = $BASE_URL . '/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=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)。

検索結果とページング8 項目

data

Douyinキーワードクエリに対する検索結果とページング詳細。

フィールド タイプ 説明
business_data array 検索結果カード。同じビデオが複数のページに表示される可能性があります。aweme_idを使用してビデオ結果の重複を排除します。
business_config object ページングとクエリ情報。
business_config.keyword string この検索に関するキーワードの報告値。
business_config.card_count integer 結果ページのカード数(報告値)。
business_config.has_more integer | string このフラグが0の場合、検索IDがまだ存在している場合を含め、停止する。結果終了応答にはページングフラグのみが含まれる場合がある。
business_config.next_page object 提供された場合の続行情報。
business_config.next_page.search_id string 次のページの検索 ID。searchId にそのまま指定し、page を一つ進めます。キーワードとフィルターは変更しません。連続するページで同じ検索 ID が返る場合があります。
status_code number | string 提供された場合のDouyin検索ステータスコード。
結果カード2 項目

data.business_data[]

フィールド タイプ 説明
data_id string 現在のレスポンス内のカードの識別子。
type integer 結果の種類コード。観察された種類には、ビデオ結果の1と関連検索の66667が含まれる。
ビデオ情報12 項目

data.business_data[].data.aweme_info

カードにビデオが含まれる場合のDouyinビデオ結果。

フィールド タイプ 説明
aweme_id string 安定したDouyinビデオIDが文字列としてエンコードされたもの。この値を使用して、検索ページ全体でビデオを識別する。
group_id string 投稿のグループ識別子。
author_user_id integer 投稿アカウントの数値ID。
desc string Douyinが提供する投稿の説明。
caption string Douyinが提供する投稿のキャプション。
item_title string 提供されている場合の投稿のタイトル。
preview_title string 投稿プレビューのタイトル。
create_time integer ビデオの公開時間、Unixタイムスタンプで秒単位。
duration integer ビデオの持続時間、ミリ秒単位。
aweme_type integer Douyinが報告する投稿のタイプコード。
media_type integer Douyinが報告するメディアタイプコード。
ip_attribution string Douyinが報告するIP地域ラベル(利用可能な場合)。
著者26 項目

data.business_data[].data.aweme_info.author

動画と共に返される著者プロフィール情報。

フィールド タイプ 説明
uid string 文字列としてエンコードされたDouyinアカウントID。
sec_uid string ユーザープロフィールエンドポイントで使用される二次的なDouyinアカウント識別子。
nickname string 著者の表示名。
unique_id string 利用可能な場合の公開Douyinアカウントハンドル。
short_id string Douyinが報告する短いアカウント識別子。
follower_count integer 著者のフォロワー数。
is_verified boolean Douyinが著者を検証済みとして報告するかどうか。
verification_type integer 著者に関する検証カテゴリコード。
avatar_thumb object 著者のアバターサムネイル。
avatar_thumb.uri string Douyinが報告するリソース識別子。
avatar_thumb.url_list array リソースのための提供されたURL。
avatar_thumb.url_list[] string リソースのための提供されたURL。
avatar_thumb.width integer メタデータで報告されるリソースのピクセル単位の幅。
avatar_thumb.height integer メタデータで報告されるリソースのピクセル単位の高さ。
avatar_medium object 著者のミディアムサイズのアバター。
avatar_medium.uri string Douyinが報告するリソース識別子。
avatar_medium.url_list array リソースのための提供されたURL。
avatar_medium.url_list[] string リソースのための提供されたURL。
avatar_medium.width integer メタデータで報告されるリソースのピクセル単位の幅。
avatar_medium.height integer メタデータで報告されるリソースのピクセル単位の高さ。
avatar_larger object 著者の大きなアバター。
avatar_larger.uri string Douyinが報告するリソース識別子。
avatar_larger.url_list array リソースのための提供されたURL。
avatar_larger.url_list[] string リソースのための提供されたURL。
avatar_larger.width integer メタデータで報告されるリソースのピクセル単位の幅。
avatar_larger.height integer メタデータで報告されるリソースのピクセル単位の高さ。
エンゲージメント7 項目

data.business_data[].data.aweme_info.statistics

動画のエンゲージメント数の報告。

フィールド タイプ 説明
aweme_id string これらの統計情報に関連するDouyin動画ID。
digg_count integer 動画のいいね数(報告値)。
comment_count integer 動画のコメント数(報告値)。
collect_count integer 動画の保存数(報告値)。
share_count integer 動画のシェア数(報告値)。
forward_count integer 応答に含まれる転送数。
download_count integer 動画のダウンロード数(報告値)。
動画のキャプション22 項目

data.business_data[].data.aweme_info.video

フィールド タイプ 説明
cover object 動画のカバー画像。
cover.uri string Douyinが報告するリソース識別子。
cover.url_list array リソースのための提供されたURL。
cover.url_list[] string リソースのための提供されたURL。
cover.width integer メタデータで報告されるリソースのピクセル単位の幅。
cover.height integer メタデータで報告されるリソースのピクセル単位の高さ。
origin_cover object 元のカバーフィールドのカバー画像。
origin_cover.uri string Douyinが報告するリソース識別子。
origin_cover.url_list array リソースのための提供されたURL。
origin_cover.url_list[] string リソースのための提供されたURL。
origin_cover.width integer メタデータで報告されるリソースのピクセル単位の幅。
origin_cover.height integer メタデータで報告されるリソースのピクセル単位の高さ。
dynamic_cover object 利用可能な場合の動くカバーリソース。
dynamic_cover.uri string Douyinが報告するリソース識別子。
dynamic_cover.url_list array リソースのための提供されたURL。
dynamic_cover.url_list[] string リソースのための提供されたURL。
dynamic_cover.width integer メタデータで報告されるリソースのピクセル単位の幅。
dynamic_cover.height integer メタデータで報告されるリソースのピクセル単位の高さ。
animated_cover object 利用可能な場合のアニメーションカバーリソース。
animated_cover.uri string Douyinが報告するリソース識別子。
animated_cover.url_list array リソースのための提供されたURL。
animated_cover.url_list[] string リソースのための提供されたURL。
再生と品質51 項目

data.business_data[].data.aweme_info.video

動画のメタデータと再生可能なリソース。

フィールド タイプ 説明
duration integer ビデオの持続時間、ミリ秒単位。
width integer Douyinが報告する動画の幅(ピクセル)。
height integer Douyinが報告する動画の高さ(ピクセル)。
format string Douyinが報告する動画の形式。
ratio string Douyinが報告する解像度ラベル。
has_watermark boolean 動画メタデータからのウォーターマークフラグ。
play_addr object 動画の主要な再生アドレス。
play_addr.uri string Douyinが報告するリソース識別子。
play_addr.url_list array リソースのための提供されたURL。
play_addr.url_list[] string リソースのための提供されたURL。
play_addr.width integer メタデータで報告されるリソースのピクセル単位の幅。
play_addr.height integer メタデータで報告されるリソースのピクセル単位の高さ。
play_addr.data_size integer メタデータで報告されるリソースファイルのサイズ(バイト)。
play_addr_h264 object H.264バリアントの提供アドレス。
play_addr_h264.uri string Douyinが報告するリソース識別子。
play_addr_h264.url_list array リソースのための提供されたURL。
play_addr_h264.url_list[] string リソースのための提供されたURL。
play_addr_h264.width integer メタデータで報告されるリソースのピクセル単位の幅。
play_addr_h264.height integer メタデータで報告されるリソースのピクセル単位の高さ。
play_addr_h264.data_size integer メタデータで報告されるリソースファイルのサイズ(バイト)。
play_addr_265 object H.265再生フィールドで提供されるアドレス。
play_addr_265.uri string Douyinが報告するリソース識別子。
play_addr_265.url_list array リソースのための提供されたURL。
play_addr_265.url_list[] string リソースのための提供されたURL。
play_addr_265.width integer メタデータで報告されるリソースのピクセル単位の幅。
play_addr_265.height integer メタデータで報告されるリソースのピクセル単位の高さ。
play_addr_265.data_size integer メタデータで報告されるリソースファイルのサイズ(バイト)。
download_addr object 動画のダウンロードアドレス。
download_addr.uri string Douyinが報告するリソース識別子。
download_addr.url_list array リソースのための提供されたURL。
download_addr.url_list[] string リソースのための提供されたURL。
download_addr.width integer メタデータで報告されるリソースのピクセル単位の幅。
download_addr.height integer メタデータで報告されるリソースのピクセル単位の高さ。
download_addr.data_size integer メタデータで報告されるリソースファイルのサイズ(バイト)。
bit_rate array 動画の再生エンコーディングとビットレートメタデータ。
bit_rate[] object ビデオ用の一つの再生エンコーディング。
bit_rate[].bit_rate integer エンコーディングのビットレート(ビット/秒)。
bit_rate[].FPS integer フレームレート(フレーム/秒)。
bit_rate[].format string このエンコーディングのメディア形式の報告。
bit_rate[].gear_name string このバリアントに関するエンコーダプリセットラベルの報告値。
bit_rate[].quality_type integer このエンコーディングに関する品質カテゴリコードの報告値。
bit_rate[].is_h265 integer このバリアントに関するH.265エンコーディングフラグの報告値。
bit_rate[].HDR_type string エンコーディングに関するHDRカテゴリラベルの返信値。
bit_rate[].HDR_bit string エンコーディングに関するHDRビット深度ラベルの返信値。
bit_rate[].play_addr object このエンコーディングの再生アドレス。
bit_rate[].play_addr.uri string Douyinが報告するリソース識別子。
bit_rate[].play_addr.url_list array リソースのための提供されたURL。
bit_rate[].play_addr.url_list[] string リソースのための提供されたURL。
bit_rate[].play_addr.width integer メタデータで報告されるリソースのピクセル単位の幅。
bit_rate[].play_addr.height integer メタデータで報告されるリソースのピクセル単位の高さ。
bit_rate[].play_addr.data_size integer メタデータで報告されるリソースファイルのサイズ(バイト)。
音楽とオーディオ17 項目

data.business_data[].data.aweme_info.music

ビデオに関連する音楽またはサウンドのメタデータ。

フィールド タイプ 説明
id integer 数値の音楽ID。JavaScriptで完全な値を保持するために無損失JSONパーサを使用する。
id_str string 文字列としてエンコードされた音楽ID。
mid string ミッドフィールドで返される音楽ID。
title string 音楽または音のトラックのタイトル。
author string トラックと共に返されるアーティストまたは音の作成者名。
album string 提供された場合のアルバムタイトル。
is_original_sound boolean Douyinがトラックをオリジナルサウンドとしてマークするかどうか。
cover_thumb object 音楽または音のトラックのサムネイルカバー。
cover_thumb.uri string Douyinが報告するリソース識別子。
cover_thumb.url_list array リソースのための提供されたURL。
cover_thumb.url_list[] string リソースのための提供されたURL。
cover_thumb.width integer メタデータで報告されるリソースのピクセル単位の幅。
cover_thumb.height integer メタデータで報告されるリソースのピクセル単位の高さ。
play_url object 音楽または音のトラックの再生リソース。
play_url.uri string Douyinが報告するリソース識別子。
play_url.url_list array リソースのための提供されたURL。
play_url.url_list[] string リソースのための提供されたURL。
共有、トピック、言及19 項目

data.business_data[].data.aweme_info

フィールド タイプ 説明
share_url string ビデオのDouyin共有URL。
share_info object ビデオを共有するためのメタデータ。
share_info.share_url string ビデオを共有するためのURL。
share_info.share_title string ビデオを共有するためのタイトル。
share_info.share_desc string ビデオを共有するための説明。
text_extra array | null 投稿テキストに関連するハッシュタグとユーザー言及。このリストはnullの場合もある。
text_extra[] object 一枚のテキストアノテーション。
text_extra[].type integer Douyinが報告するアノテーションのタイプコード。
text_extra[].hashtag_id string アノテーションがハッシュタグを表す場合のハッシュタグのID。
text_extra[].hashtag_name string アノテーションが付いたハッシュタグの名前。
text_extra[].user_id string アノテーションでユーザーが言及されている場合のDouyinアカウントID。
text_extra[].sec_uid string 言及されたユーザーのための二次的なDouyinアカウントID。
text_extra[].is_commerce boolean アノテーションされたハッシュタグがDouyinによって商業的と判断されるかどうか。
cha_list array | null 投稿に関連するトピックまたはチャレンジの詳細。このリストはnullの場合もあります。
cha_list[] object 一つのトピックまたは課題。
cha_list[].cid string DouyinのトピックまたはチャレンジID。
cha_list[].cha_name string トピックまたはチャレンジの名前。
cha_list[].desc string トピックまたはチャレンジの説明。
cha_list[].is_commerce boolean トピックまたはチャレンジがDouyinによって商業的と判断されるかどうか。
関連検索3 項目

data.business_data[].data

フィールド タイプ 説明
related_word_list array カードに関連検索語が含まれる場合の推奨関連検索語。
related_word_list[] object 一つの関連検索提案。
related_word_list[].related_word string 推奨関連検索語。
その他のフィールド2 項目
フィールドパス タイプ 説明
data.business_data[] object 検索結果リストで返される一枚のカード。
data.business_data[].data object 結果カードの内容。フィールドはカードの種類に依存する。

レスポンス例 ​

レスポンスのサンプルを読み込んでいます...