视频文件下载
curl --request GET \
--url https://api.powertokens.ai/v1/videos/{task_id}/content \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.powertokens.ai/v1/videos/{task_id}/content"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.powertokens.ai/v1/videos/{task_id}/content', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.powertokens.ai/v1/videos/{task_id}/content",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.powertokens.ai/v1/videos/{task_id}/content"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.powertokens.ai/v1/videos/{task_id}/content")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.powertokens.ai/v1/videos/{task_id}/content")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body"<string>"{
"code": "task_not_ready",
"message": "任务尚未完成,暂不可下载",
"data": null
}{
"code": "access_denied",
"message": "无效的令牌",
"data": null
}{
"code": "task_not_found",
"message": "任务不存在或已过期",
"data": null
}{
"code": "insufficient_user_quota",
"message": "当前账户额度不足,请稍后重试",
"data": null
}{
"code": "gen_relay_info_failed",
"message": "服务内部处理失败,请稍后重试",
"data": null
}{
"code": "bad_response_status_code",
"message": "上游服务返回了无效响应",
"data": null
}{
"code": "get_channel_failed",
"message": "当前模型暂时无可用渠道,请稍后重试",
"data": null
}视频模型
下载视频文件
在异步视频任务完成后下载最终视频文件内容。
当你需要直接获取媒体文件,而不是处理临时结果地址时,应使用此接口。
GET
/
v1
/
videos
/
{task_id}
/
content
视频文件下载
curl --request GET \
--url https://api.powertokens.ai/v1/videos/{task_id}/content \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.powertokens.ai/v1/videos/{task_id}/content"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.powertokens.ai/v1/videos/{task_id}/content', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.powertokens.ai/v1/videos/{task_id}/content",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.powertokens.ai/v1/videos/{task_id}/content"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.powertokens.ai/v1/videos/{task_id}/content")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.powertokens.ai/v1/videos/{task_id}/content")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body"<string>"{
"code": "task_not_ready",
"message": "任务尚未完成,暂不可下载",
"data": null
}{
"code": "access_denied",
"message": "无效的令牌",
"data": null
}{
"code": "task_not_found",
"message": "任务不存在或已过期",
"data": null
}{
"code": "insufficient_user_quota",
"message": "当前账户额度不足,请稍后重试",
"data": null
}{
"code": "gen_relay_info_failed",
"message": "服务内部处理失败,请稍后重试",
"data": null
}{
"code": "bad_response_status_code",
"message": "上游服务返回了无效响应",
"data": null
}{
"code": "get_channel_failed",
"message": "当前模型暂时无可用渠道,请稍后重试",
"data": null
}⌘I