Omni
Tải xuống nội dung video Omni
Tải xuống tệp MP4 đã hoàn thành cho một tác vụ video Omni beta thông qua route content.
GET
/
v1
/
videos
/
{task_id}
/
content
cURL
curl https://api.cometapi.com/v1/videos/<TASK_ID>/content \
-H "Authorization: Bearer $COMETAPI_KEY" \
--output output.mp4import os
from pathlib import Path
import requests
TASK_ID = "<TASK_ID>"
response = requests.get(
f"https://api.cometapi.com/v1/videos/{TASK_ID}/content",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
timeout=300,
)
response.raise_for_status()
Path("output.mp4").write_bytes(response.content)import { writeFile } from "node:fs/promises";
const TASK_ID = "<TASK_ID>";
const response = await fetch(
`https://api.cometapi.com/v1/videos/${TASK_ID}/content`,
{ headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` } },
);
if (!response.ok) {
throw new Error(await response.text());
}
const video = new Uint8Array(await response.arrayBuffer());
await writeFile("output.mp4", video);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/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.cometapi.com/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.cometapi.com/v1/videos/{task_id}/content")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/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>"{
"error": {
"message": "Task is not completed yet. Status: IN_PROGRESS",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Task not found",
"type": "invalid_request_error"
}
}Sử dụng endpoint này để tải xuống tệp MP4 cho một tác vụ video Omni beta đã hoàn thành. Nếu tác vụ vẫn đang chạy, API sẽ trả về lỗi JSON thay vì dữ liệu byte của video.
Trạng thái: Beta
Trước khi tải xuống
- Tạo một tác vụ với Tạo một video Omni.
- Thăm dò với Truy xuất một video Omni cho đến khi
statuslàcompleted. - Truyền cùng một task ID vào endpoint này.
Lưu trữ media đã hoàn thành
Phần thân phản hồi là nội dung nhị phânvideo/mp4. Lưu các byte vào hệ thống lưu trữ của riêng bạn khi ứng dụng của bạn cần quyền truy cập lâu dài vào media được tạo ra.Lần sửa đổi cuối 10 tháng 8, 2026
⌘I
cURL
curl https://api.cometapi.com/v1/videos/<TASK_ID>/content \
-H "Authorization: Bearer $COMETAPI_KEY" \
--output output.mp4import os
from pathlib import Path
import requests
TASK_ID = "<TASK_ID>"
response = requests.get(
f"https://api.cometapi.com/v1/videos/{TASK_ID}/content",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
timeout=300,
)
response.raise_for_status()
Path("output.mp4").write_bytes(response.content)import { writeFile } from "node:fs/promises";
const TASK_ID = "<TASK_ID>";
const response = await fetch(
`https://api.cometapi.com/v1/videos/${TASK_ID}/content`,
{ headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` } },
);
if (!response.ok) {
throw new Error(await response.text());
}
const video = new Uint8Array(await response.arrayBuffer());
await writeFile("output.mp4", video);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/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.cometapi.com/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.cometapi.com/v1/videos/{task_id}/content")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/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>"{
"error": {
"message": "Task is not completed yet. Status: IN_PROGRESS",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Task not found",
"type": "invalid_request_error"
}
}