本文へ移動

Kuaishou 動画詳細 API (V2) ​

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

ビデオIDで識別されたKuaishouビデオの公開詳細を取得します。検索後やユーザーが公開したビデオを発見した後に、選択したビデオを確認するために使用します。

ハイライト ​

ガイダンス

main_urlのclientCacheKeyパラメータからvideoIdを読み取り、.jpg接尾辞を削除してください。

パラメータ ​

名前 パラメーターの場所 タイプ 必須 デフォルト 説明
token query string はい - このAPIサービスのアクセストークン。
videoId query string はい - Kuaishouから返されるユニークなビデオ識別子。

コードサンプル ​

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

パラメーター:
- token (query): このAPIサービスのアクセストークン。 (必須)
- videoId (query): Kuaishouから返されるユニークなビデオ識別子。 (必須)

返信形式:実際の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/kuaishou/get-video-detail/v2?token=YOUR_API_KEY&videoId=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/kuaishou/get-video-detail/v2?token=YOUR_API_KEY&videoId=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/kuaishou/get-video-detail/v2?token=YOUR_API_KEY&videoId=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/kuaishou/get-video-detail/v2?token=YOUR_API_KEY&videoId=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/kuaishou/get-video-detail/v2?token=YOUR_API_KEY&videoId=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)。

動画の詳細9 項目

data.photos[]

一つのKuaishouビデオ記録。

フィールド タイプ 説明
photo_id integer 数値のKuaishouビデオID。JSONを解析する際にその完全な精度を保持する。
originalPhotoId string 元のKuaishouビデオの文字列識別子。
caption string ビデオと共に公開されたキャプション。
time string ビデオに表示される公開時間ラベル。
timestamp integer ビデオの公開時間(Unixタイムスタンプ、ミリ秒単位)。
duration integer ビデオの持続時間、ミリ秒単位。
type integer Kuaishouが報告するビデオのタイプコード。
photo_status integer クアイショウが報告するビデオのステータスコード。
longVideo boolean クアイショウが該当ビデオを長編ビデオとしてマークするかどうか。
エンゲージメント6 項目

data.photos[]

フィールド タイプ 説明
view_count integer 報告されたビデオの視聴回数。
like_count integer 報告されたビデオのいいね数。
comment_count integer 報告されたビデオのコメント数。
collect_count integer 報告されたビデオの保存数。
share_count integer 報告されたビデオのシェア数。
forward_count integer 報告されたビデオの転送数。
動画の作成者7 項目

data.photos[]

フィールド タイプ 説明
user_id integer ビデオの投稿者であるクアイショウアカウントの数値ID。
user_name string 動画の投稿者の表示名。
kwaiId string 利用可能な場合の公開クアイショウアカウント識別子。
verified boolean ビデオの投稿者アカウントが認証済みとして表示されるかどうか。
headurls array ビデオの投稿者用アバターURL。
headurls[] object 利用可能な一つのリンクバリエーション。
headurls[].url string このバリエーションのURL。
動画ファイルとカバー画像13 項目

data.photos[]

フィールド タイプ 説明
main_mv_urls array 主要なビデオアセットの利用可能なURL。
main_mv_urls[] object 利用可能な一つのリンクバリエーション。
main_mv_urls[].url string このバリエーションのURL。
cover_thumbnail_urls array ビデオカバーの利用可能なサムネイルURL。
cover_thumbnail_urls[] object 利用可能な一つのリンクバリエーション。
cover_thumbnail_urls[].url string このバリエーションのURL。
ff_cover_thumbnail_urls array クアイショウが報告した追加のビデオカバーサムネイルURL。
ff_cover_thumbnail_urls[] object 利用可能な一つのリンクバリエーション。
ff_cover_thumbnail_urls[].url string このバリエーションのURL。
ext_params object 追加のビデオサイズ。
ext_params.w integer ビデオメタデータに記録された幅、ピクセル単位。
ext_params.h integer ビデオメタデータに記録された高さ、ピクセル単位。
streamManifest object 再生マニフェストおよびビデオの技術的音声メタデータ。
再生マニフェストとストリームグループ7 項目

data.photos[].streamManifest

フィールド タイプ 説明
version string 再生マニフェストのバージョン。
videoId string 再生マニフェストで使用されるビデオ識別子。
adaptationSet array 利用可能な再生レンダイングのグループ。
adaptationSet[] object 再生レンダイブロックグループの一つ。
adaptationSet[].id integer マニフェスト内のレンダインググループの識別子。
adaptationSet[].duration integer このグループの再生時間、ミリ秒単位。
adaptationSet[].representation array この再生グループ内で利用可能な再生形式。
再生形式19 項目

data.photos[].streamManifest.adaptationSet[].representation[]

一つの再生形式。

フィールド タイプ 説明
id integer 再生マニフェストにおけるこの再生形式の識別子。
url string この再生形式に関する報告された再生URL。
maxBitrate integer この再生形式の報告された最大ビットレート、キロビット/秒。
avgBitrate integer この再生形式の報告された平均ビットレート、キロビット/秒。
width integer この再生形式のピクセル単位の幅。
height integer この再生形式のピクセル単位の高さ。
frameRate number この再生形式のフレームレート、フレーム/秒。
quality number この再生形式のビデオ品質を示す数値指標。
qualityType string この再生形式に関する報告された品質カテゴリコード。
qualityLabel string この再生形式のビデオ品質の表示ラベル。
hdrType integer この再生形式に関する報告されたHDRタイプコード。
fileSize integer この再生形式のファイルサイズ、バイト数。
mute boolean この再生形式がミュート状態かどうか。
backupUrl array この再生形式のバックアップ再生URL。
backupUrl[] string 一つのバックアップ再生URL。
volumeInfo object この再生形式の音声の音量測定値。
volumeInfo.loudness number 報告された音声の音量。
volumeInfo.lra number 報告された音量範囲。
volumeInfo.tp number 報告された音声の真のピーク値。
画像と音声のサイズ14 項目

data.photos[].streamManifest

フィールド タイプ 説明
videoFeature object ビデオ画像に関する報告された技術的測定値。
videoFeature.blurProbability number 画像のぼやけの発生確率。
videoFeature.blockyProbability number 視覚的なブロックアーティファクトの発生確率。
videoFeature.avgEntropy number 報告された平均画像エントロピー。
videoFeature.mosScore number 報告された平均意見スコア(MOS)の品質指標。
videoFeature.contrast number 報告された画像コントラスト指標。
audioFeature object ビデオの音声に関する報告された技術的測定値。
audioFeature.audioQuality number 報告された音質指標。
audioFeature.musicProbability number 音楽が含まれている確率の報告値。
audioFeature.dialogProbability number 対話が含まれている確率の報告値。
audioFeature.backgroundSoundProbability number 背景音が含まれている確率の報告値。
audioFeature.stereophonicRichness number ステレオ豊かさ指標の報告値。
audioFeature.audioSnr number 音声のノイズレベルの報告値。
audioFeature.effectiveBandwidthInHz number 効果的な音声帯域幅(ヘルツ)の報告値。
サウンドトラック20 項目

data.photos[].soundTrack

サウンドトラックのメタデータおよび関連リソース。

フィールド タイプ 説明
id string サウンドトラックの識別子。
name string サウンドトラックに表示されるタイトル。
artist string サウンドトラックに表示されるアーティスト名。
duration integer サウンドトラックの持続時間(秒)の報告値。
photoId integer このサウンドトラックに関連するKuaishouビデオの数値ID。JSON解析時にはその完全な精度を保持する。
type integer Kuaishouが報告したサウンドトラックのタイプコード。
audioType integer サウンドトラックの報告されたオーディオタイプコード。
genreId integer サウンドトラックの報告されたジャンル識別子。
loudness number 報告されたサウンドトラックの音量。
isOffline boolean Kuaishouがこのサウンドトラックがオフラインであることを報告しているかどうか。
hasCopyright boolean Kuaishouがこのサウンドトラックに対して報告した著作権フラグ。
audioUrls array サウンドトラックの利用可能な再生URL。
audioUrls[] object 利用可能な一つのリンクバリエーション。
audioUrls[].url string このバリエーションのURL。
imageUrls array サウンドトラックの利用可能な画像URL。
imageUrls[] object 利用可能な一つのリンクバリエーション。
imageUrls[].url string このバリエーションのURL。
avatarUrls array サウンドトラックと共に表示されるアバターURL。
avatarUrls[] object 利用可能な一つのリンクバリエーション。
avatarUrls[].url string このバリエーションのURL。
サウンドトラック付きのアカウント7 項目

data.photos[].soundTrack.user

サウンドトラックと共に表示される公開アカウント情報。

フィールド タイプ 説明
user_id integer サウンドトラックと共に表示されるKuaishouアカウントIDの数値。
user_name string アカウントの表示名、サウンドトラックと共に表示される。
kwaiId string 利用可能な場合の公開クアイショウアカウント識別子。
headurl string アカウントの主要なアバターURL、サウンドトラックと共に表示される。
headurls array アカウントのアバターURLのバリエーション、サウンドトラックと共に表示される。
headurls[] object 利用可能な一つのリンクバリエーション。
headurls[].url string このバリエーションのURL。
レスポンス状態2 項目

data

応答に存在する場合のKuaishouビデオの詳細。

フィールド タイプ 説明
result integer Kuaishouのペイロード状態コード。ここで観察された充填された応答は1を使用している。
photos array 要求された識別子に対して返されるビデオ記録(利用可能な場合)。

レスポンス例 ​

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