Skip to main content
GET
/
v1
/
videos
/
{task_id}
/
content
获取视频内容
curl --request GET \
  --url https://api.chenyu.cn/v1/videos/{task_id}/content \
  --header 'Authorization: Bearer <token>'

获取视频内容

当视频任务已完成时,可通过该接口获取视频内容。接口会在视频可用时跳转到实际视频文件地址。

请求参数

task_id
string
required
视频任务 ID,由 创建视频任务 返回

响应说明

任务完成且视频地址可用时,接口返回 HTTP 跳转响应,客户端可跟随跳转下载或播放视频。 如果任务未完成或失败,会返回错误信息。

代码示例

import requests

task_id = "cgt-20260602154730-twmv2"
url = f"https://api.chenyu.cn/v1/videos/{task_id}/content"
headers = {"Authorization": "Bearer your_api_key"}

response = requests.get(url, headers=headers, allow_redirects=True)
open("output.mp4", "wb").write(response.content)

错误示例

{
  "error": {
    "type": "invalid_request_error",
    "code": "video_not_ready",
    "message": "The video task is not completed yet."
  }
}