本文へ移動

YOUKU 動画検索 API (V1) ​

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

キーワードでYouku動画をページベースのペーニングで検索します。トピック、タイトル、クリエイター、またはその他の検索語句に関連する動画を発見するために使用します。

パラメータ ​

名前 パラメーターの場所 タイプ 必須 デフォルト 説明
token query string はい - TOKEN
keyword query string はい - 検索するキーワード。
page query integer いいえ 1 ページ番号、1から始まる。

コードサンプル ​

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

パラメーター:
- token (query): TOKEN (必須)
- 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/youku/search-video/v1?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/youku/search-video/v1?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/youku/search-video/v1?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/youku/search-video/v1?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/youku/search-video/v1?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)。

ページと検索メタデータ9 項目

data.data

検索ページのメタデータとネストされた結果グループ。

フィールド タイプ 説明
more boolean Youkuがこの検索ページの追加結果を報告するかどうか。
data object 返されるページの検索メタデータ。
data.pg integer この検索応答で報告されるページ番号。
data.pz integer Youkuが報告するページサイズ。返される結果グループの数は異なることがあります。
data.total integer この検索応答で報告される合計数。ページごとに変動することがあります。
data.isEnd integer Youkuが報告する結果終了のインジケーター。より多くの結果がある場合は0、終わりにあたる場合は1を使用します。
data.displaySearchTerms string 表示のために返される検索語句。
data.highlightWord string ハイライトのために返される検索テキスト。
data.status string Youkuが報告する検索状態テキスト。
結果ツリー9 項目

data.data

フィールド タイプ 説明
nodes array 第一級の検索結果グループ。
nodes[].type integer この結果ノードのプラットフォームタイプコード。
nodes[].level integer この結果ノードに対して報告されるネストレベル。
nodes[].nodes array オプション情報やカードを表示するオプションのあるネストされた結果グループ。
nodes[].nodes[].type integer この結果ノードのプラットフォームタイプコード。
nodes[].nodes[].level integer この結果ノードに対して報告されるネストレベル。
nodes[].nodes[].nodes array 動画、番組、エピソード、その他の結果コンテンツのネストカード。
nodes[].nodes[].nodes[].type integer この結果ノードのプラットフォームタイプコード。
nodes[].nodes[].nodes[].level integer この結果ノードに対して報告されるネストレベル。
結果の表示22 項目

data.data.nodes[].nodes[].data

一部の結果グループに対して返されるメタデータの表示。

フィールド タイプ 説明
showId string Youkuによって返される識別子。
programId string Youkuによってテキストとして返される番組識別子。
titleDTO object 結果のタイトル表示情報。
titleDTO.displayName string 結果に対して返される表示タイトル。
tempTitle string 結果に対して返される追加タイトルテキスト。
cateId integer 結果に対して返されるコンテンツカテゴリコード。
cats string 結果と共に表示されるコンテンツカテゴリラベル。
info string 表示オプションに対して返される説明テキスト。
episodeTotal integer 番組の総エピソード数が報告される数値。
episodeType integer 番組に対して報告されるエピソードタイプコード。
completed integer 完了を示すプラットフォームインジケータ。
isTrailer integer トレーラーを示すプラットフォームインジケータ。
paid integer 有料コンテンツを示すプラットフォームインジケータ。
exclusive integer 独占コンテンツを示すプラットフォームインジケータ。
sourceName string 結果として表示される公開動画サービスの名前。
thumbUrl string 結果に対して返されるサムネイルのURL。
posterDTO object 結果のポスター表示情報。
posterDTO.vThumbUrl string 結果に対して返されるポスターの画像URL。
posterDTO.iconCorner object 画像に付随するコーナーバッジ。
posterDTO.iconCorner.tagText string バッジに表示されるテキスト。
posterDTO.iconCorner.tagType integer このバッジのプラットフォームタイプコード。
posterDTO.posterType string ポスターに対して返される表示タイプテキスト。
動画とエピソード32 項目

data.data.nodes[].nodes[].nodes[].data

カードデータ。利用可能なフィールドは結果のタイプによって異なります。

フィールド タイプ 説明
showId string Youkuによって返される識別子。
programId string Youkuによってテキストとして返される番組識別子。
titleDTO object 結果のタイトル表示情報。
titleDTO.displayName string 結果に対して返される表示タイトル。
tempTitle string 結果に対して返される追加タイトルテキスト。
cateId integer 結果に対して返されるコンテンツカテゴリコード。
cats string 結果と共に表示されるコンテンツカテゴリラベル。
info string 表示オプションに対して返される説明テキスト。
episodeTotal integer 番組の総エピソード数が報告される数値。
episodeType integer 番組に対して報告されるエピソードタイプコード。
completed integer 完了を示すプラットフォームインジケータ。
isTrailer integer トレーラーを示すプラットフォームインジケータ。
paid integer 有料コンテンツを示すプラットフォームインジケータ。
exclusive integer 独占コンテンツを示すプラットフォームインジケータ。
sourceName string 結果として表示される公開動画サービスの名前。
videoId string 結果に対して返される動画識別子。
vid string エピソードカード上で数値テキストとして返される動画識別子。
realShowId string realShowIdフィールドに返される番組識別子。
docId integer | string 結果に対して返される検索ドキュメント識別子。整数または文字列の形式を取ることがあります。
title string このカード結果によって直接返されるタイトルテキスト。
subtitle string このカード結果に対して返される字幕。
displayName string エピソードと直接一緒に返される表示名。
releaseDate string 結果に対してテキストとして表示される公開年。
publishTime string 動画が表示される際の出版時刻ラベル。
userName string 動画結果に対して返される公開アップローダーネーム。
userId string 動画結果に対して返されるアップローダー識別子。
sourceImg string 結果と一緒に表示される動画サービスのアイコン画像URL。
bulletScreenCount string 報告されたバーレットコメント数、数値テキストとして返される。
seconds string 動画の秒数単位でのエピソード持続時間、数値テキストとして返される。
showVideoSeq integer 番組内の動画の報告されたシーケンス番号。
showVideoStage string 表示用のエピソードまたはステージのラベルが返されました。
notice string 結果として公開通知テキストが返されました。
サムネイルとバッジ27 項目

data.data.nodes[].nodes[].nodes[].data

フィールド タイプ 説明
thumbUrl string 結果に対して返されるサムネイルのURL。
iconCorner object 画像に付随するコーナーバッジ。
iconCorner.tagText string バッジに表示されるテキスト。
iconCorner.tagType integer このバッジのプラットフォームタイプコード。
posterDTO object 結果のポスター表示情報。
posterDTO.vThumbUrl string 結果に対して返されるポスターの画像URL。
posterDTO.iconCorner object 画像に付随するコーナーバッジ。
posterDTO.iconCorner.tagText string バッジに表示されるテキスト。
posterDTO.iconCorner.tagType integer このバッジのプラットフォームタイプコード。
posterDTO.posterType string ポスターに対して返される表示タイプテキスト。
posterDTO.labelInfo object 投稿者に付けられた表示ラベル。
posterDTO.labelInfo.text object 投稿ラベルのタイトルとサブタイトルテキスト。
posterDTO.labelInfo.text.title string 投稿ラベルに表示されるタイトルテキスト。
posterDTO.labelInfo.text.subTitle string 投稿ラベルに表示されるサブタイトルテキスト。
posterDTO.leftBottomText object 投稿の左下に表示されるテキスト。
posterDTO.leftBottomText.title string 投稿バッジの左下に表示される主要な表示テキスト。
posterDTO.topLeftCorner object 投稿の左上に表示されるテキスト。
posterDTO.topLeftCorner.firstText string 投稿バッジの左上に表示される主要なテキスト。
posterDTO.topLeftCorner.recommendText string 投稿バッジの左上に表示される推薦テキスト。
screenShotDTO object 動画のサムネイルと表示オーバーレイ。
screenShotDTO.thumbUrl string 結果に対して返されるサムネイルのURL。
screenShotDTO.rightBottomText string サムネイルの右下角に表示されるテキスト。
screenShotDTO.iconCorner object 画像に付随するコーナーバッジ。
screenShotDTO.iconCorner.tagText string バッジに表示されるテキスト。
screenShotDTO.iconCorner.tagType integer このバッジのプラットフォームタイプコード。
screenShotDTO.newImgInfo object 代替動画サムネイル情報。
screenShotDTO.newImgInfo.thumbUrl string 結果に対して返されるサムネイルのURL。
表示されるフィルターオプション15 項目

data.data.data.filter

表示のために返される検索オプション。

フィールド タイプ 説明
cate array プラットフォームの検索インターフェースで表示可能なカテゴリ。
cate[].id string テキストとして返されるカテゴリオプションの識別子。
cate[].title string 選択肢の表示名。
duration array 表示のために返される期間オプション。
duration[].title string 選択肢の表示名。
duration[].value string オプションに対して返される文字列値。
format array 表示用に返されるフォーマットオプション。
format[].title string 選択肢の表示名。
format[].value integer オプションに対して返される整数値。
tab array 表示用に返される検索タブ。
tab[].id string 検索タブの識別子がテキストとして返される。
tab[].title string 選択肢の表示名。
tab[].orders array このタブに対して返されるソートオプション。
tab[].orders[].title string 選択肢の表示名。
tab[].orders[].value integer オプションに対して返される整数値。
プラットフォームのステータス2 項目

data

Youkuの動画検索結果とプラットフォームの状態。

フィールド タイプ 説明
ret array Youkuから返される状態メッセージ。
ret[] string 個々のプラットフォームの状態メッセージ。

レスポンス例 ​

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