本文へ移動

Kuaishou 動画検索 API (V2) ​

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

キーワードによる公開Kuaishou動画をページ番号によるページングで検索します。関連する動画を発見し、ページ別に結果を閲覧するために使用できます。

パラメータ ​

名前 パラメーターの場所 タイプ 必須 デフォルト 説明
token query string はい - このAPIサービスのアクセストークン。
keyword query string はい - ビデオを検索するための検索キーワード。
page query integer いいえ 1 結果のページ番号、1から始まる。

コードサンプル ​

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

パラメーター:
- token (query): このAPIサービスのアクセストークン。 (必須)
- keyword (query): ビデオを検索するための検索キーワード。 (必須)
- page (query): 結果のページ番号、1から始まる。

返信形式:実際の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/search-video/v2?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/kuaishou/search-video/v2?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/kuaishou/search-video/v2?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/kuaishou/search-video/v2?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/kuaishou/search-video/v2?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)。

作業詳細15 項目

data.feeds[]

検索によって返される一つのKuaishou作品。

フィールド タイプ 説明
photo_id integer JSON整数として返されるKuaishou作品識別子。完全なIDを保持するために無損失JSON解析を使用する。
caption string 作品に対応するキャプション。
time string 表示テキストとしての公開時間。
timestamp integer 作品の公開時間、Unixタイムスタンプでミリ秒単位。
type integer 検索結果に対応する数値コンテンツタイプ。
photo_status integer Kuaishou作品の数値ステータスコード。
longVideo boolean 返されるとき、作品が長いビデオとしてマークされているかどうか。
editInfo object 利用可能な場合、作品の編集情報。
editInfo.editVersion integer 作品の報告された編集バージョン。
editInfo.editTime integer 編集時間、Unixタイムスタンプでミリ秒単位。
editInfo.coverVersion integer 作品のカバーの報告された編集バージョン。
disclaimerMessage string 返されるとき、作品に関連する開示メッセージ。
hasVote boolean 作品が投票を含むとしてマークされているかどうか。
hasMusicTag boolean 作品が音楽ラベルとしてマークされているかどうか。
tags array 作品のタグリストが報告されました。
ページングと結果2 項目

data

要求されたキーワードに対応する公開のKuaishou作品のページ。

フィールド タイプ 説明
result integer プラットフォームの検索結果コード。成功した検索のペイロードは1を返す。
feeds array 要求されたページに対応する作品。同じ作品が複数のページに表示されることがある。photo_idを使用してページ間の作品を照合する。
著者8 項目

data.feeds[]

フィールド タイプ 説明
user_id integer Kuaishouの著者識別子の数値。
user_name string 投稿者の表示名。
kwaiId string 提供された場合、著者の公開Kuaishou IDが表示されます。
verified boolean 著者が認証済みとしてマークされているかどうか。
headurl string 著者のアバター画像のURL。
headurls array 著者に利用可能なアバター画像のリンク。
headurls[] object アセットに利用可能な一つのリンク。
headurls[].url string アセットバリアントのURL。
エンゲージメント5 項目

data.feeds[]

フィールド タイプ 説明
like_count integer 作品のいいね数の報告数。
comment_count integer 作品のコメント数の報告数。
view_count integer 作品の視聴数の報告数。
forward_count integer 作品のフォワード数の報告数。
share_count integer 作品のシェア数の報告数。
メディアリンクとギャラリー24 項目

data.feeds[]

フィールド タイプ 説明
duration integer 動画の報告された持続時間。画像作品の場合は省略可能。
main_url string 作品のメイン画像URL。
thumbnail_url string 作品のサムネイル画像URL。
main_mv_url string 作品のメイン動画が返されたURL。
main_mv_urls array メイン動画に利用可能なURL。
main_mv_urls[] object アセットに利用可能な一つのリンク。
main_mv_urls[].url string アセットバリアントのURL。
thumbnail_urls array 作品に利用可能なサムネイル画像URL。
thumbnail_urls[] object アセットに利用可能な一つのリンク。
thumbnail_urls[].url string アセットバリアントのURL。
cover_thumbnail_urls array 作品に利用可能なカバーサムネイル画像URL。
cover_thumbnail_urls[] object アセットに利用可能な一つのリンク。
cover_thumbnail_urls[].url string アセットバリアントのURL。
ext_params object 作品のサイズとオプションのギャラリー情報。
ext_params.mtype integer 作品の報告されている数値メディアタイプ。
ext_params.w integer 報告されているメディアのピクセル幅。
ext_params.h integer 報告されているメディアのピクセル高さ。
ext_params.atlas object 複数画像作品のギャラリー情報。
ext_params.atlas.list array ギャラリー内の画像の参照パス。検証済みのエントリはパス文字列です。
ext_params.atlas.list[] string ギャラリー画像の参照パス。
ext_params.atlas.size array ギャラリー画像のサイズ。検証済みの行は位置によってリストと一致します。
ext_params.atlas.size[] object ギャラリー画像のサイズ。
ext_params.atlas.size[].w integer 画像のピクセル単位の幅。
ext_params.atlas.size[].h integer 画像のピクセル単位の高さ。
再生マニフェスト22 項目

data.feeds[]

フィールド タイプ 説明
streamManifest object 動画メディアに返された再生マニフェスト。
streamManifest.version string 再生マニフェストのバージョン。
streamManifest.videoId string 再生マニフェストに含まれる動画識別子。
streamManifest.adaptationSet array マニフェスト内の再生レンダイブロックグループ。
streamManifest.adaptationSet[] object 再生レンダイブロックグループの一つ。
streamManifest.adaptationSet[].id integer この再生グループの数値識別子。
streamManifest.adaptationSet[].duration integer この再生グループで報告されている再生時間。
streamManifest.adaptationSet[].representation array このグループで利用可能な再生形式。
streamManifest.adaptationSet[].representation[] object 利用可能な再生形式の一つ。
streamManifest.adaptationSet[].representation[].id integer この再生形式の数値識別子。
streamManifest.adaptationSet[].representation[].url string この形式の再生URL。
streamManifest.adaptationSet[].representation[].backupUrl array この形式の代替再生URL。
streamManifest.adaptationSet[].representation[].backupUrl[] string 代替再生URLの一つ。
streamManifest.adaptationSet[].representation[].maxBitrate integer この形式の報告されている最大ビットレート。
streamManifest.adaptationSet[].representation[].avgBitrate integer この形式の報告されている平均ビットレート。
streamManifest.adaptationSet[].representation[].width integer 再生フレームのピクセル幅。
streamManifest.adaptationSet[].representation[].height integer 再生フレームのピクセル高さ。
streamManifest.adaptationSet[].representation[].frameRate number 再生形式の報告されているフレームレート。
streamManifest.adaptationSet[].representation[].quality number この形式の報告されている数値品質レベル。
streamManifest.adaptationSet[].representation[].qualityType string この再生形式の品質タイプラベル。
streamManifest.adaptationSet[].representation[].qualityLabel string この形式の品質の表示ラベル。
streamManifest.adaptationSet[].representation[].defaultSelect boolean この形式がデフォルト選択用にマークされているかどうか。
表示サイズと位置17 項目

data.feeds[]

フィールド タイプ 説明
photoDisplayLocationInfo object 作品の表示エリアと画像のサイズが報告されているもの。
photoDisplayLocationInfo.leftRatio number 表示エリアの相対的な左位置。
photoDisplayLocationInfo.topRatio number 表示エリアの相対的な上位置。
photoDisplayLocationInfo.widthRatio number 表示エリアの相対的な幅。
photoDisplayLocationInfo.heightRatio number 表示エリアの相対的な高さ。
photoDisplayLocationInfo.displayWidth integer 表示エリアのピクセル単位の幅。
photoDisplayLocationInfo.displayHeight integer 表示エリアのピクセル単位の高さ。
photoDisplayLocationInfo.photoWidth integer 作品画像のピクセル単位の幅。
photoDisplayLocationInfo.photoHeight integer 作品画像のピクセル単位の高さ。
poi object 作品に付随する観光名所、提供されている場合。
poi.id integer 付随する観光地の数値識別子。
poi.title string 付随する観光地に表示される名前。
poi.city string 付随する観光地の都市ラベル。
poi.address string 付随する観光地の住所ラベル。
poi.latitude number 付随する観光地の緯度が報告されているもの。
poi.longitude number 付随する観光地の経度が報告されているもの。
poi.category integer 付随する観光地の数値カテゴリコードが報告されているもの。

レスポンス例 ​

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