ข้ามไปยังเนื้อหา

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
ฉันต้องการใช้ API "การค้นหาวิดีโอ (V2)" จาก JustOneAPI.
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-th.json

พารามิเตอร์:
- token (query): โทเค็นการเข้าถึงสำหรับบริการ API นี้ (จำเป็น)
- keyword (query): คำสำคัญสำหรับการค้นหาวิดีโอ (จำเป็น)
- page (query): หมายเลขหน้าสำหรับผลลัพธ์ เริ่มจาก 1

รูปแบบที่ส่งกลับ: จัดการ JSON หรือข้อความอย่างปลอดภัยตามค่า Content-Type ที่ได้รับจริง

การจัดการผลตอบกลับและรหัสข้อผิดพลาด:
1. ตรวจสอบผลการทำงานจากฟิลด์ "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"  # ให้โดยเซิร์ฟเวอร์ OpenAPI

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"; // ให้โดยเซิร์ฟเวอร์ OpenAPI
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"; // ให้โดยเซิร์ฟเวอร์ OpenAPI
        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" // ให้โดยเซิร์ฟเวอร์ OpenAPI

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'; // ให้โดยเซิร์ฟเวอร์ OpenAPI
$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 ตัวระบุผลงาน Kuaishou ที่ส่งกลับในรูปแบบ JSON จำนวนเต็ม ใช้การแยกข้อมูล JSON อย่างไม่สูญเสียเพื่อรักษาอันดับที่สมบูรณ์ของ ID
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 ID Kuaishou สาธารณะที่แสดงสำหรับผู้เขียน หากมีให้.
verified boolean ว่าผู้เขียนถูกจัดการเป็น verified หรือไม่.
headurl string URL ของรูปภาพ Avatar ของผู้เขียน.
headurls array ลิงก์รูปภาพ Avatar ที่มีอยู่สำหรับผู้เขียน.
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 รหัสหมวดหมู่ตัวเลขที่รายงานสำหรับสถานที่ที่เกี่ยวข้อง。

ตัวอย่างผลการตอบกลับ ​

กำลังโหลดตัวอย่างการตอบกลับ...