Kuaishou รายละเอียดวิดีโอ API (V2)
สืบค้นข้อมูลสาธารณะของวิดีโอ Kuaishou โดยใช้ ID ของวิดีโอ ใช้เพื่อตรวจสอบวิดีโอที่เลือกหลังจากการค้นหาหรือการค้นพบวิดีโอที่ผู้ใช้ได้เผยแพร่
สิ่งที่น่าสนใจ
คำแนะนำ
อ่าน videoId จากพารามิเตอร์ clientCacheKey ใน main_url และลบสกุลนาม .jpg ออก
พารามิเตอร์
| ชื่อ | ตำแหน่ง | ชนิดข้อมูล | จำเป็น | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|---|---|
token |
query | string |
ใช่ | - | โทเค็นการเข้าถึงสำหรับบริการ API นี้ |
videoId |
query | string |
ใช่ | - | ตัวระบุวิดีโอที่ไม่ซ้ำกันซึ่ง Kuaishou ส่งคืน |
ตัวอย่างโค้ด
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/kuaishou/get-video-detail/v2?token=YOUR_API_KEY&videoId=VALUE'
ฉันต้องการใช้ API "รายละเอียดวิดีโอ (V2)" จาก JustOneAPI.
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-th.json
พารามิเตอร์:
- token (query): โทเค็นการเข้าถึงสำหรับบริการ API นี้ (จำเป็น)
- videoId (query): ตัวระบุวิดีโอที่ไม่ซ้ำกันซึ่ง Kuaishou ส่งคืน (จำเป็น)
รูปแบบที่ส่งกลับ: จัดการ 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 และจัดการการตอบกลับ.
import requests
BASE_URL = "https://api.justoneapi.com" # ให้โดยเซิร์ฟเวอร์ OpenAPI
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")
const BASE_URL = "https://api.justoneapi.com"; // ให้โดยเซิร์ฟเวอร์ OpenAPI
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`);
}
}
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/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");
}
}
}
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/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
$BASE_URL = 'https://api.justoneapi.com'; // ให้โดยเซิร์ฟเวอร์ OpenAPI
$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 |
ID ของวิดีโอ Kuaishou ในรูปแบบตัวเลข ให้รักษาความแม่นยำของมันไว้ขณะแปล JSON |
originalPhotoId |
string |
ตัวระบุสตริงสำหรับวิดีโอ Kuaishou ต้นฉบับ |
caption |
string |
คำบรรยายที่เผยแพร่พร้อมกับวิดีโอ |
time |
string |
ป้ายเวลาเผยแพร่สำหรับวิดีโอ |
timestamp |
integer |
เวลาเผยแพร่วิดีโอในรูปแบบเวลาอูนิกซ์ (Unix) ในหน่วยมิลลิวินาที |
duration |
integer |
ความยาวของวิดีโอในหน่วยมิลลิวินาที |
type |
integer |
รหัสประเภทวิดีโอที่รายงานโดย Kuaishou |
photo_status |
integer |
รหัสสถานะวิดีโอที่รายงานโดย Kuaishou |
longVideo |
boolean |
ว่ากuaishou จะจัดให้วิดีโอนั้นเป็นวิดีโอยาวหรือไม่ |
ระดับความสนใจจากผู้ใช้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 ของบัญชี Kuaishou ที่ใช้เป็นตัวระบุผู้สร้างวิดีโอ |
user_name |
string |
ชื่อที่แสดงของผู้เผยแพร่วิดีโอ |
kwaiId |
string |
ตัวระบุบัญชี Kuaishou สาธารณะ หากมี |
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 สำหรับแผ่นขนาดย่อของวิดีโอหน้าปกเพิ่มเติมที่รายงานโดย Kuaishou |
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 |
ตัวระบุกลุ่มรูปแบบการเล่นใน manifest |
adaptationSet[].duration |
integer |
ระยะเวลาการเล่นที่บันทึกไว้สำหรับกลุ่มนี้ ในหน่วยมิลลิวินาที |
adaptationSet[].representation |
array |
รูปแบบการเล่นที่มีอยู่ในกลุ่มการเล่นนี้ |
รูปแบบการเล่น19 ฟิลด์
data.photos[].streamManifest.adaptationSet[].representation[]
รูปแบบการเล่นหนึ่งรูปแบบ
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
id |
integer |
ตัวระบุรูปแบบการเล่นนี้ใน manifest การเล่น |
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 |
มาตรวัดคุณภาพ Mean Opinion Score (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 |
ID ตัวเลขของวิดีโอ Kuaishou ที่เกี่ยวข้องกับเสียงประกอบนี้ รักษาความแม่นยำของข้อมูลขณะแปล 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 |
ID ของบัญชี Kuaishou ในรูปแบบตัวเลขที่แสดงพร้อมกับเสียงประกอบ. |
user_name |
string |
ชื่อแสดงผลของบัญชีที่แสดงพร้อมกับเสียงประกอบ. |
kwaiId |
string |
ตัวระบุบัญชี Kuaishou สาธารณะ หากมี |
headurl |
string |
URL ของภาพลักษณ์หลักของบัญชีที่แสดงพร้อมกับเสียงประกอบ. |
headurls |
array |
URL ของภาพลักษณ์ย่อยสำหรับบัญชีที่แสดงพร้อมกับเสียงประกอบ. |
headurls[] |
object |
รูปแบบลิงก์ที่มีอยู่หนึ่งรูปแบบ |
headurls[].url |
string |
URL สำหรับรูปแบบลิงก์นี้ |
สถานะการตอบกลับ2 ฟิลด์
data
รายละเอียดวิดีโอของ Kuaishou หากมีอยู่ในการตอบกลับ
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
result |
integer |
รหัสสถานะของ payload ของ Kuaishou ค่าที่ตอบกลับมาใช้ 1 |
photos |
array |
วิดีโอที่ส่งกลับมาเพื่อหมายเลขที่ขอ หากมี |