跳至主要內容

快手用戶發佈視頻 API (V2) ​

GET
API 端點健康狀態
健康 可用 少量可用 基本不可用 暫無資料
正在載入健康狀態…

獲取快手用戶發佈的公開視頻,支持可選的基於游標的分頁。用於查看創作者的視頻歷史或選擇視頻進行詳細信息和評論請求。

請求參數 ​

參數名 位置 類型 必填 預設值 說明
token query string 是 - 此 API 服務的訪問令牌。
userId query string 是 - 快手平台上的唯一用戶ID。
pcursor query string 否 - 用於後續頁面的分頁游標。

程式碼範例 ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/kuaishou/get-user-video-list/v2?token=YOUR_API_KEY&userId=VALUE'
text
我想使用 JustOneAPI 提供的“用戶發佈視頻 (V2)”接口。
接入地址: https://api.justoneapi.com。
接口路徑: /api/kuaishou/get-user-video-list/v2?token=YOUR_API_KEY&userId=VALUE
接口地址: BASE_URL + /api/kuaishou/get-user-video-list/v2?token=YOUR_API_KEY&userId=VALUE
HTTP 方法: GET
身份驗證: 在 URL 中傳入 token 查詢參數。
OpenAPI 定義: https://docs.justoneapi.com/openapi/kuaishou/user-published-videos-v2-zh-hant.json

請求參數說明:
- token (query): 此 API 服務的訪問令牌。 (必填)
- userId (query): 快手平台上的唯一用戶ID。 (必填)
- pcursor (query): 用於後續頁面的分頁游標。

返回格式: 請根據實際 Content-Type 安全處理 JSON 或文本回應。

回應處理與錯誤代碼:
1. 需通過返回體中的 "code" 欄位判斷業務結果(code 為 0 表示成功)。
2. 逾時建議:建議將請求逾時時間設置為 120 秒;如果 120 秒偏長,請至少設置為 60 秒,但可能會有少量請求因逾時而未接收到結果。
3. 業務碼說明:
   - 0: 成功
   - 100: Token 無效或已失效
   - 301: 採集失敗,請重試
   - 302: 超出速率限制
   - 303: 超出每日配額
   - 400: 參數錯誤
   - 500: 內部伺服器錯誤
   - 600: 權限不足
   - 601: 帳戶餘額不足
   - 602: TOKEN 限額超限
4. code 601 表示帳戶共享餘額不足。code 602 表示當前 API TOKEN 自身的累計消費上限已達到。TOKEN 限額不是資金劃撥,多個 TOKEN 仍共享同一個帳戶餘額。

請幫我用我擅長的編程語言寫一個腳本來呼叫這個接口,並處理返回結果。
python
import requests

BASE_URL = "https://api.justoneapi.com"  # 由 OpenAPI servers 提供

url = BASE_URL + "/api/kuaishou/get-user-video-list/v2?token=YOUR_API_KEY&userId=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 servers 提供
const url = BASE_URL + "/api/kuaishou/get-user-video-list/v2?token=YOUR_API_KEY&userId=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 servers 提供
        final String url = BASE_URL + "/api/kuaishou/get-user-video-list/v2?token=YOUR_API_KEY&userId=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 servers 提供

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/kuaishou/get-user-video-list/v2?token=YOUR_API_KEY&userId=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 servers 提供
$url = $BASE_URL . '/api/kuaishou/get-user-video-list/v2?token=YOUR_API_KEY&userId=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)的主要返回欄位。

作品列表與分頁3 個欄位

data

請求的快手帳號公開作品的一頁結果。

欄位 類型 說明
result integer 作品列表資料返回的狀態代碼。
feeds array 當前頁的作品列表,可能為空。
pcursor string 原樣傳入返回的游標作為 pcursor,並使用同一個 userId 請求下一頁。返回 no_more 表示沒有下一頁。
作品信息10 個欄位

data.feeds[]

此帳號返回的一條作品。

欄位 類型 說明
photo_id integer 快手作品 ID。此整數可能超出 JavaScript 的安全整數範圍,需用無損 JSON 解析保留全部數字。
caption string 作品文案。
type integer 平台返回的作品類型代碼。
photo_status integer 平台返回的作品狀態代碼。
timestamp integer 作品發佈時間,單位為 Unix 紀元毫秒。
time string 發佈時間展示文本。
duration integer 作品資料報告的時長,單位為毫秒。
longVideo boolean 作品是否帶有長視頻標記。
hasVote boolean 作品是否包含投票。
hasMusicTag boolean 作品是否帶有音樂標籤。
發佈帳號9 個欄位

data.feeds[]

欄位 類型 說明
user_id integer 發佈作品的帳號數字 ID。
user_name string 發佈作品的帳號展示名稱。
user_sex string 作品作者的性別標記。
kwaiId string 作品作者公開的快手號。請求參數 userId 使用帳號的數字 ID。
verified boolean 作品作者的認證標記。
headurls array 作品作者的頭像圖片來源列表。
headurls[] object 作品作者頭像的一條圖片來源。
headurls[].cdn string 此媒體來源的 CDN 標識。
headurls[].url string 作品作者的頭像圖片地址。
互動與評論9 個欄位

data.feeds[]

欄位 類型 說明
like_count integer 平台返回的作品點贊數。
comment_count integer 作品評論數。
view_count integer 作品觀看次數。
collect_count integer 作品收藏數。
share_count integer 平台返回的作品分享數。
forward_count integer 作品轉發數。
commentInfo object 作品返回的評論設置。
commentInfo.permissions integer 平台返回的評論權限代碼。
enableShareToStory boolean 作品是否標記為可分享到快手日常。
封面與播放地址12 個欄位

data.feeds[]

欄位 類型 說明
cover_thumbnail_urls array 作品封面縮略圖來源列表。
cover_thumbnail_urls[] object 封面縮略圖的一條來源。
cover_thumbnail_urls[].cdn string 此媒體來源的 CDN 標識。
cover_thumbnail_urls[].url string 封面縮略圖地址。
ff_cover_thumbnail_urls array 作品返回的另一組封面縮略圖來源。
ff_cover_thumbnail_urls[] object 另一組封面縮略圖中的一條來源。
ff_cover_thumbnail_urls[].cdn string 此媒體來源的 CDN 標識。
ff_cover_thumbnail_urls[].url string 另一組封面縮略圖的圖片地址。
main_mv_urls array 主要視頻播放來源列表。
main_mv_urls[] object 主要視頻播放來源中的一條記錄。
main_mv_urls[].cdn string 此媒體來源的 CDN 標識。
main_mv_urls[].url string 主要視頻播放地址。
視頻編碼信息19 個欄位

data.feeds[].streamManifest

視頻流的技術元資料。

欄位 類型 說明
mediaType integer 視頻流元資料中的媒體類型代碼。
videoId string 視頻流元資料中的視頻標識。
adaptationSet array 視頻可用的編碼版本分組。
adaptationSet[] object 一組視頻編碼版本。
adaptationSet[].id integer 編碼版本分組的標識。
adaptationSet[].duration integer 此編碼版本分組報告的時長,單位為毫秒。
adaptationSet[].representation array 此分組中的可用視頻編碼版本。
adaptationSet[].representation[] object 一個視頻編碼版本的技術元資料。
adaptationSet[].representation[].id integer 此視頻編碼版本的標識。
adaptationSet[].representation[].width integer 該視頻版本的寬度,單位為像素。
adaptationSet[].representation[].height integer 該視頻版本的高度,單位為像素。
adaptationSet[].representation[].frameRate number 此視頻編碼版本的幀率,單位為幀每秒。
adaptationSet[].representation[].maxBitrate integer 此視頻編碼版本返回的最大碼率。
adaptationSet[].representation[].avgBitrate integer 此視頻編碼版本返回的平均碼率。
adaptationSet[].representation[].quality integer 此視頻編碼版本的畫質代碼。
adaptationSet[].representation[].qualityType string 此視頻編碼版本的畫質類型。
adaptationSet[].representation[].qualityLabel string 此視頻編碼版本的畫質展示名稱。
adaptationSet[].representation[].hdrType integer 此視頻編碼版本的 HDR 類型代碼。
adaptationSet[].representation[].mute boolean 此視頻編碼版本是否帶有靜音標記。
配樂信息11 個欄位

data.feeds[].soundTrack

作品使用的配樂信息。

欄位 類型 說明
id string 配樂 ID。
name string 配樂名稱。
artist string 配樂返回的藝人名稱。
duration integer 配樂資料報告的時長。
photoId integer 配樂關聯的作品 ID,可能超出 JavaScript 的安全整數範圍。
type integer 平台返回的配樂類型代碼。
audioType integer 平台返回的配樂音頻類型代碼。
genreId integer 平台返回的配樂流派標識。
loudness number 平台返回的配樂響度值。
isOffline boolean 配樂是否標記為下線。
hasCopyright boolean 平台返回的配樂版權標記。
配樂帳號與媒體21 個欄位

data.feeds[].soundTrack

欄位 類型 說明
user object 配樂關聯的帳號信息。
user.user_id integer 配樂關聯帳號的數字 ID。
user.user_name string 配樂關聯帳號的展示名稱。
user.kwaiId string 配樂關聯帳號公開的快手號。
user.headurl string 配樂關聯帳號的頭像地址。
user.headurls array 配樂關聯帳號的頭像圖片來源列表。
user.headurls[] object 配樂關聯帳號頭像的一條圖片來源。
user.headurls[].cdn string 此媒體來源的 CDN 標識。
user.headurls[].url string 配樂關聯帳號的頭像地址。
imageUrls array 配樂的圖片來源列表。
imageUrls[] object 配樂的一條圖片來源。
imageUrls[].cdn string 此媒體來源的 CDN 標識。
imageUrls[].url string 配樂圖片地址。
avatarUrls array 配樂資料返回的頭像圖片來源列表。
avatarUrls[] object 配樂資料中的一條頭像圖片來源。
avatarUrls[].cdn string 此媒體來源的 CDN 標識。
avatarUrls[].url string 配樂資料返回的頭像圖片地址。
audioUrls array 配樂的音頻來源列表。
audioUrls[] object 配樂的一條音頻來源。
audioUrls[].cdn string 此媒體來源的 CDN 標識。
audioUrls[].url string 配樂的音頻地址。
推廣展示7 個欄位

data.feeds[].ad

部分作品附帶的推廣信息。

欄位 類型 說明
title string 推廣標題。
merchantTitle string 推廣信息返回的商家標題。
merchantDescription string 推廣信息返回的商家描述。
merchantEnhanceDisplay object 推廣信息附帶的商家展示信息。
merchantEnhanceDisplay.merchantDisplayTitleInfo string 商家標題的展示文案。
merchantEnhanceDisplay.merchantDisplayPriceInfo string 商家價格的展示文案。
merchantEnhanceDisplay.merchantSaleInfo string 商家銷量的展示文案。

回應示例 ​

正在載入回應範例…