主题
获取 YouTube 视频信息结果(按任务 ID,高级版)
本接口使用 GET 方法,通过任务 ID 获取 YouTube 视频信息结果。
请求路径:
text
GET https://api.seermartech.cn/v3/serp/youtube/video_info/task_get/advanced/$id计费说明
- 本接口对首次提交任务计费。
- 任务结果可在任务创建后的 30 天获取,查询结果不额外收费。
- 实扣费以响应头
X-SeerMarTech-Charge-CNY为准。
请求参数
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,采用 UUID 格式。任务创建后 30 天均可使用该 ID 查询结果。 |
示例任务 ID:
text
02261816-2027-0066-0000-c27d02864073响应说明
接口返回 JSON 数据,顶层 tasks 数组。每个任务对象中任务状态、请求参数和视频信息结果。
如需查看该端点支持的 SERP 特征和扩展字段,可访问沙箱接口:
text
https://sandbox.seermartech.cn/v3/serp/youtube/video_info/task_get/advanced/00000000-0000-0000-0000-000000000000沙箱接口返回虚拟数据的完整字段,不会产生费用。
顶层响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 通用响应状态码。 |
status_message | string | 通用状态说明。 |
time | string | 请求执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务数量。 |
tasks_error | integer | tasks 数组中返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
任务字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。 |
status_code | integer | 任务状态码,通常位于 10000–60000 范围。 |
status_message | string | 任务状态说明。 |
time | string | 任务执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的结果数量。 |
path | array | 请求路径信息。 |
data | object | 创建任务时提交的请求参数。 |
result | array | 任务结果数组。 |
> 建议根据 status_code 和 status_message 实现异常处理。完整状态码和错误信息请参考错误码文档。
data 请求参数字段
| 字段 | 类型 | 说明 |
|---|---|---|
video_id | string | 请求中提交的视频 ID。 |
se_domain | string | 请求中提交的搜索引擎域名。 |
location_code | integer | 请求中提交的地区代码。 |
language_code | string | 请求中提交的语言代码。 |
result 字段
| 字段 | 类型 | 说明 |
|---|---|---|
video_id | string | 视频 ID。 |
se_domain | string | 搜索引擎域名。 |
location_code | integer | 地区代码。 |
language_code | string | 语言代码。 |
check_url | string | 搜索引擎结果页的直接 URL,可用于核验返回结果。 |
datetime | string | 获取结果的日期和时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。 |
spell | object | 搜索引擎自动纠错信息。 |
refinement_chips | object | 搜索细化选项。该端点通常返回 null。 |
item_types | array | SERP 中的结果类型。该端点可能 youtube_video_info。 |
items_count | integer | items 数组中的结果数量。 |
items | array | SERP 结果数组。 |
youtube_video_info 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 结果类型,固定为 youtube_video_info。 |
rank_group | integer | 同类型结果中的组排名。 |
rank_absolute | integer | 在 SERP素中的绝对排名。 |
video_id | string | 视频 ID。 |
title | string | 视频标题。 |
url | string | 视频 URL。 |
thumbnail_url | string | 视频缩略图 URL。 |
channel_id | string | 发布视频的频道 ID。 |
channel_name | string | 发布视频的频道名称。 |
channel_url | string | 频道 URL。 |
channel_logo | string | 频道 Logo 图片 URL。 |
description | string | 视频描述。 |
views_count | integer | 视频观看次数。 |
likes_count | integer | 视频点赞数。 |
comments_count | integer | 视频评论数。 |
channel_subscribers_count | object | 频道订人数。 |
publication_date | string | 视频发布日期。 |
timestamp | string | 视频发布时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。 |
keywords | array | 与视频的,也称 YouTube 标签。 |
category | string | 视频所属分类。 |
is_live | boolean | 是否为直播视频。 |
is_embeddable | boolean | 是否嵌播放。 |
duration_time | string | 视频时长,格式示例:02:09。 |
duration_time_seconds | integer | 视频时长,单位为秒。 |
subtitles | array | 视频字幕信息数组。 |
streaming_quality | array | 视频支持的流媒体质量信息。 |
channel_subscribers_count 字段
| 字段 | 类型 | 说明 |
|---|---|---|
displayed_count | string | 平台页面展示的订人数,例如 478K subscribers。 |
count | integer | 频道订人数。 |
subtitles 字段
| 字段 | 类型 | 说明 |
|---|---|---|
language | string | 字幕语言。 |
is_translatable | boolean | 字幕是否支持翻译。 |
is_auto_generated | boolean | 字幕是否由系统自动生成。 |
streaming_quality 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 streaming_quality_element。 |
label | string | 晰度标签。 |
width | integer | 视频宽度,单位为像素。 |
height | integer | 视频高度,单位为像素。 |
bitrate | integer | 视频码率。 |
mime_type | string | 视频媒体类型。 |
fps | integer | 视频帧率。 |
请求示例
cURL
bash
id="02261816-2027-0066-0000-c27d02864073"
curl --location --request GET \
"https://api.seermartech.cn/v3/serp/youtube/video_info/task_get/advanced/${id}" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"TypeScript
typescript
import axios from "axios";
const taskId = "02231256-2604-0066-2000-57133b8fc54e";
axios
.get(
`https://api.seermartech.cn/v3/serp/youtube/video_info/task_get/advanced/${taskId}`,
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
)
.then((response) => {
// 处理任务结果
console.log(response.data);
})
.catch((error) => {
// 处理请求错误
console.error(error.response?.data || error.message);
});Python
python
import requests
task_id = "02261816-2027-0066-0000-c27d02864073"
url = (
"https://api.seermartech.cn/v3/serp/youtube/video_info/"
f"task_get/advanced/{task_id}"
)
response = requests.get(
url,
headers={
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
)
if response.ok:
result = response.json()
print(result)
else:
print(f"HTTP 错误:{response.status_code}")
print(response.text)响应示例
json
{
"version": "0.1.20240801",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0529 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "02261816-2027-0066-0000-c27d02864073",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0412 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"serp",
"youtube",
"video_info",
"task_get",
"advanced",
"02261816-2027-0066-0000-c27d02864073"
],
"data": {
"api": "serp",
"function": "task_get",
"se": "youtube",
"se_type": "video_info",
"language_code": "en",
"location_code": 2840,
"video_id": "vQXvyV0zIP4",
"device": "desktop",
"os": "windows"
},
"result": [
{
"video_id": "vQXvyV0zIP4",
"se_domain": "youtube.com",
"location_code": 2840,
"language_code": "en",
"check_url": "https://www.youtube.com/watch?v=vQXvyV0zIP4",
"datetime": "2024-08-01 12:00:00 +00:00",
"spell": null,
"refinement_chips": null,
"item_types": [
"youtube_video_info"
],
"items_count": 1,
"items": [
{
"type": "youtube_video_info",
"rank_group": 1,
"rank_absolute": 1,
"video_id": "vQXvyV0zIP4",
"title": "示例视频标题",
"url": "https://www.youtube.com/watch?v=vQXvyV0zIP4",
"thumbnail_url": "https://i.ytimg.com/vi/vQXvyV0zIP4/maxresdefault.jpg",
"channel_id": "UCexample",
"channel_name": "示例频道",
"channel_url": "https://www.youtube.com/channel/UCexample",
"channel_logo": "https://example.com/channel-logo.jpg",
"description": "示例视频描述",
"views_count": 5582858,
"likes_count": 100649,
"comments_count": 4367,
"channel_subscribers_count": {
"displayed_count": "478K subscribers",
"count": 478000
},
"publication_date": "Premiered Jan 26, 2021",
"timestamp": "2021-01-26 23:00:09 +00:00",
"keywords": [
"示例"
],
"category": "Autos & Vehicles",
"is_live": false,
"is_embeddable": true,
"duration_time": "02:09",
"duration_time_seconds": 129,
"subtitles": null,
"streaming_quality": [
{
"type": "streaming_quality_element",
"label": "720p",
"width": 1280,
"height": 720,
"bitrate": 2500000,
"mime_type": "video/mp4",
"fps": 30
}
]
}
]
}
]
}
]
}实用场景
- 提取视频基础信息:批量获取标题、描述、缩略图、频道和发布时间,为视频库和竞品监测提供标准化数据。
- 分析视频互动表现:统计观看、点赞、评论和频道订人数,评估视频传播效果与受众参与度。
- 监测竞品频道:定期获取指定视频的分类、标签、时长和直播状态,支持竞品频道跟踪与策略分析。
- 筛选适合嵌的素材:根据
is_embeddable、字幕和视频时长字段,筛选适合发布到站专题页或落地页的视频。 - 评估视频技术质量:分析晰度、分辨率、码率和帧率等
streaming_quality数据,为视频播放体验和采集策略提供依据。