主题
GET /v3/serp/youtube/video_comments/tasks_ready
/v3/serp/youtube/video_comments/tasks_ready
GET https://api.seermartech.cn/v3/serp/youtube/video_comments/task_get/advanced/$id
https://api.seermartech.cn/v3/serp/youtube/video_comments/task_get/advanced/$id
根据任务 ID 获取 YouTube 视频评论结果。任务结果自提交任务后 30 天可重复获取,获取结果本身不额外扣费。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
X-SeerMarTech-Charge-CNY
接口使用路径参数,无需请求体。
id
id="02261816-2027-0066-0000-c27d02864073" curl --location --request GET \ "https://api.seermartech.cn/v3/serp/youtube/video_comments/task_get/advanced/${id}" \ --header "Authorization: Bearer smt_live_YOUR_KEY" \ --header "Content-Type: application/json"
import axios from "axios"; const taskId = "02231256-2604-0066-2000-57133b8fc54e"; axios .get( `https://api.seermartech.cn/v3/serp/youtube/video_comments/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); });
import requests task_id = "02261816-2027-0066-0000-c27d02864073" url = ( "https://api.seermartech.cn" f"/v3/serp/youtube/video_comments/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 数据,顶层 tasks 数组。每个任务对象任务状态、请求参数和结果数据。
tasks
version
status_code
status_message
time
cost
tasks_count
tasks_error
10000
60000
result_count
result
path
data
data 通常提交任务时使用的参数,例如:
api
serp
function
task_get
se
youtube
se_type
video_comments
language_code
location_code
video_id
priority
device
desktop
os
windows
se_domain
check_url
datetime
yyyy-mm-dd hh-mm-ss +00:00
2019-11-15 12:57:46 +00:00
spell
refinement_chips
null
item_types
youtube_comment
title
comments_count
items_count
items
type
rank_group
rank_absolute
author_name
author_thumbnail
author_url
text
publication_date
timestamp
2022-11-15 12:57:46 +00:00
likes_count
reply_count
{ "version": "0.1.20220819", "status_code": 20000, "status_message": "Ok.", "time": "0.0816 sec.", "cost": 0, "tasks_count": 1, "tasks_error": 0, "tasks": [ { "id": "02261816-2027-0066-0000-c27d02864073", "status_code": 20000, "status_message": "Ok.", "time": "0.0721 sec.", "cost": 0, "result_count": 1, "path": [ "v3", "serp", "youtube", "video_comments", "task_get", "advanced" ], "data": { "api": "serp", "function": "task_get", "se": "youtube", "se_type": "video_comments", "language_code": "en", "location_code": 2840, "video_id": "vQXvyV0zIP4", "priority": 2, "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": "2022-11-15 12:57:46 +00:00", "spell": null, "refinement_chips": null, "item_types": [ "youtube_comment" ], "title": "The first-ever BMW M5 CS.", "comments_count": 4081, "items_count": 2, "items": [ { "type": "youtube_comment", "rank_group": 1, "rank_absolute": 1, "author_name": "示例用户", "author_thumbnail": "https://example.com/author-thumbnail.jpg", "author_url": "https://www.youtube.com/@example", "text": "示例评论", "publication_date": "2022-11-15", "timestamp": "2022-11-15 12:57:46 +00:00", "likes_count": 128, "reply_count": 6 } ] } ] } ] }
当顶层 status_code 或任务级 status_code 不为成功状态时,应优读取对应的 status_message。
当 result 为空时,不应直接视为接口异常,建议结合任务状态码判断任务是否仍在处理或返回错误。
comments_count 表示视频评论总数,items_count 表示本次返回的评论条数,两可能不同。
任务结果保留 30 天,建议在任务完成后及时保存业务所需数据。
如需查询已完成任务列表,可调用:
再根据返回的任务 ID 调用本接口。
按 ID 获取 YouTube 视频评论结果(高级版)
GET
/v3/serp/youtube/video_comments/tasks_ready接口说明
GET
https://api.seermartech.cn/v3/serp/youtube/video_comments/task_get/advanced/$id根据任务 ID 获取 YouTube 视频评论结果。任务结果自提交任务后 30 天可重复获取,获取结果本身不额外扣费。
扣费以响应头
X-SeerMarTech-Charge-CNY为准。请求参数
接口使用路径参数,无需请求体。
id请求示例
curl
TypeScript
Python
响应结构
接口返回 JSON 数据,顶层
tasks数组。每个任务对象任务状态、请求参数和结果数据。顶层字段
versionstatus_codestatus_messagetimecostX-SeerMarTech-Charge-CNY为准。tasks_counttasks数组中的任务数量。tasks_errortasks数组中返回错误的任务数量。taskstasks任务字段 idstatus_code10000至60000范围。status_messagetimecostX-SeerMarTech-Charge-CNY为准。result_countresult数组中的数量。pathdataresultdata字段 data通常提交任务时使用的参数,例如:apiserp。functiontask_get。seyoutube。se_typevideo_comments。language_codelocation_codevideo_idprioritydevicedesktop。oswindows。result结果字段 video_idse_domainlocation_codelanguage_codecheck_urldatetimeyyyy-mm-dd hh-mm-ss +00:00。示例:2019-11-15 12:57:46 +00:00。spellrefinement_chipsnull。item_typesyoutube_comment。titlecomments_countitems_countitems数组中返回的评论数量。itemsitems评论字段 typeyoutube_comment。rank_grouptype的在所属分组中的位置;不同类型之间的位置不会计此字段。rank_absoluteauthor_nameauthor_thumbnailauthor_urltextpublication_datetimestampyyyy-mm-dd hh-mm-ss +00:00。示例:2022-11-15 12:57:46 +00:00。likes_countreply_count响应示例
处理建议
当顶层
status_code或任务级status_code不为成功状态时,应优读取对应的status_message。当
result为空时,不应直接视为接口异常,建议结合任务状态码判断任务是否仍在处理或返回错误。comments_count表示视频评论总数,items_count表示本次返回的评论条数,两可能不同。任务结果保留 30 天,建议在任务完成后及时保存业务所需数据。
如需查询已完成任务列表,可调用:
GET /v3/serp/youtube/video_comments/tasks_ready再根据返回的任务 ID 调用本接口。
实用场景