Skip to content

提交 Google News SERP 任务

GET /v3/serp/google/news/task_post

通过本接口可提交 Google News 搜索结果抓取任务。返回结果会根据你指定的地域和语言进行采集。

接口支持两种执行优级:

  • 1:普通优级(默认)
  • 2:高优级

接口地址

POST https://api.seermartech.cn/v3/serp/google/news/task_post

计费说明

本接口在创建任务时计费。

  • 深度 depth 默认按每 10 条结果为一个计费单位
  • depth > 10 且返回结果 10 条时,可能产生额外扣费
  • 若你设置的 depth 高于返回条数,差额会自动退回余额
  • 若使用高优级 priority=2,会额外加价
  • 若中特定高级搜索操作符,单任务费用会按规则放大
  • 若启用 calculate_rectangles=true,单任务费用会变为原来的 2 倍

扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求说明

  • 请求体为 UTF-8 编码的 JSON
  • POST 请求体格式为:[{ ... }]
  • 单次 POST 最多提交 100 个任务
  • 每分钟最多可发起 2000 次 API 调用
  • 如果单次请求中任务数 100,出部分会返回错误 40006

你可以在任务创建后通过返回的唯一任务 ID 获取结果;也可以在创建任务时传 postback_urlpingback_url,由本平台在任务完成后主动通知你。

回调说明

  • pingback_url:任务完成后,向你指定地址发起 GET 请求
  • postback_url:任务完成后,向你指定地址发起 POST 请求,并以 gzip 压缩形式发送结果
  • 若你的服务器在 10 秒未响应,连接会时中断,任务会转 /v3/serp/google/news/tasks_ready/ 列表,供你后续主动拉取

你可以在回调 URL 中使用:

  • $id:任务 ID
  • $tag:你传的任务标记值(URL 编码后)

例如:

  • https://your-server.com/pingscript?id=$id
  • https://your-server.com/pingscript?id=$id&tag=$tag

注意:pingback_urlpostback_url 中的特殊字符会被自动 URL 编码,例如 # 会被编码为 %23

主参数

字段类型说明
keywordstring。搜索,最长 700 个字符%## 会被解码,+ 会被解码为空格。如需传递字面量 %,请写为 %25;如需传递字面量 +,请写为 %2B。若 allinanchor:allintext:allintitle:allinurl:define:filetype:id:inanchor:info:intext:intitle:inurl:link:related:site: 等搜索操作符,单任务费用按 5 倍计cache: 的查询不支持,会返回校验错误。
location_codeinteger搜索地域编码。若未传 location_namelocation_coordinate,则该字段。传此字段后无需再传 location_namelocation_coordinate。可通过 /v3/serp/google/locations 或容位置列表接口获取地域编码。示例:2840
language_codestring搜索语言编码。若未传 language_name,则该字段。传此字段后无需再传 language_name。可通过 /v3/serp/google/languages 或容语言列表接口获取。示例:en
depthinteger可选。解析深度,即返回的 SERP 结果数量。默认值:10;最大值:700
priorityinteger可选。任务优级:1 = 普通优级;2 = 高优级。高优级会额外收费。
pingback_urlstring可选。任务完成通知地址。系统会向该地址发送 GET 请求。支持 $id$tag 变量。
postback_urlstring可选。任务结果回传地址。系统会向该地址发送 POST 请求,并以 gzip 压缩格式传输结果。支持 $id$tag 变量。
postback_datastring当设置 postback_url。表示回传的数据类型,可选值:advancedhtml

附加参数

字段类型说明
location_namestring完整地域名称。若未传 location_codelocation_coordinate,则该字段填。传此字段后无需再传 location_codelocation_coordinate。示例:London,England,United Kingdom
language_namestring完整语言名称。若未传 language_code,则该字段填。传此字段后无需再传 language_code。示例:English
osstring可选。设备操作系统。该接口提供桌面端结果。可选值:windowsmacos。默认:windows
tagstring可选。自定义任务标识,最长 255 字符。可用于后续结果对账和任务追踪。该值会出现在响应的 data 对象中。
max_crawl_pagesinteger可选。最大抓取页数。最大值:100。该参数与 depth合使用。
search_paramstring可选。附加搜索参数,用于控制查询行为。
calculate_rectanglesboolean可选。是否计算高级结果中各的像素排名位置,即结果块到页面左上角的像素距离。默认:false。若设为 true,单任务费用按 2 倍计。
browser_screen_widthinteger可选。浏览器屏幕宽度。用于像素排名计算。默认:1920。使用该参数时需同时设置 calculate_rectangles=true
browser_screen_heightinteger可选。浏览器屏幕高度。用于像素排名计算。默认:1080。使用该参数时需同时设置 calculate_rectangles=true
browser_screen_resolution_ratiointeger可选。屏幕分辨率比例。用于像素排名计算。默认:1。使用该参数时需同时设置 calculate_rectangles=true
urlstring可选。直接传搜索 URL,系统会自动解析为相应字段。不推荐优使用,因为这种方式对 URL 中地域、语言等信息要求更严格,处理复杂度也更高。
location_coordinatestringGPS 坐标定位。若未传 location_namelocation_code,则该字段填。格式为 "latitude,longitude,radius"。纬度和经度最多 7 位小数;radius 最小值 199.9(毫米),最大值 199999(毫米)。示例:53.476225,-2.243572,200
se_domainstring可选。搜索引擎域名。系统通常会根据地域和语言自动选择,你也可以手动指定,如 google.co.ukgoogle.com.augoogle.de

响应结构

接口返回 JSON 格式数据,任务创建结果。

顶层字段

字段类型说明
versionstring当前 API 版本
status_codeinteger通用状态码
status_messagestring通用状态信息
timestring执行耗时,单位秒
costfloat本次请求总费用
tasks_countintegertasks 数组中的任务数量
tasks_errorinteger返回错误的任务数量
tasksarray任务数组

tasks 数组字段

字段类型说明
idstring平台唯一任务 ID,UUID 格式
status_codeinteger任务状态码,范围通常为 10000-60000
status_messagestring任务状态说明
timestring任务处理耗时
costfloat单个任务费用
result_countintegerresult 数组中的数量
patharrayURL 路径信息
dataobject回显你提交的任务参数
resultarray | null任务创建接口中通常为 null,结果需后续查询或通过回调接收

常见状态与错误

代码说明
20000请求成功
20100任务已创建
40006单次 POST 请求中的任务数 100,出部分被拒绝
10000-60000任务级状态码范围,建议根据返回值实现异常处理与重试逻辑

请求示例

cURL

bash
curl --location --request POST "https://api.seermartech.cn/v3/serp/google/news/task_post" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
 {
 "language_code": "en",
 "location_code": 2840,
 "keyword": "albert einstein"
 }
]'

Python

python
import requests

url = "https://api.seermartech.cn/v3/serp/google/news/task_post"
headers = {
 "Authorization": "Bearer smt_live_YOUR_KEY",
 "Content-Type": "application/json"
}

data = [
 {
 # 示例 1:最简任务,指定语言、地域和
 "language_code": "en",
 "location_code": 2840,
 "keyword": "albert einstein"
 },
 {
 # 示例 2:附加参数,高优级 + pingback 回调
 "language_name": "English",
 "location_name": "United States",
 "keyword": "albert einstein",
 "priority": 2,
 "tag": "some_string_123",
 "pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag"
 },
 {
 # 示例 3:直接传搜索 URL,并通过 postback 接收结果
 "url": "https://www.google.co.uk/search?q=albert%20einstein&hl=en&gl=GB&uule=w+CAIQIFISCXXeIa8LoNhHEZkq1d1aOpZS",
 "postback_data": "html",
 "postback_url": "https://your-server.com/postbackscript"
 }
]

response = requests.post(url, headers=headers, json=data)
print(response.json)

TypeScript

typescript
import axios from "axios";

const postArray = [
 {
 // 示例 1:最简任务
 language_code: "en",
 location_code: 2840,
 keyword: "albert einstein"
 },
 {
 // 示例 2:高优级 + pingback 回调
 language_name: "English",
 location_name: "United States",
 keyword: "albert einstein",
 priority: 2,
 tag: "some_string_123",
 pingback_url: "https://your-server.com/pingscript?id=$id&tag=$tag"
 },
 {
 // 示例 3:直接传 URL + postback 回传结果
 url: "https://www.google.co.uk/search?q=albert%20einstein&hl=en&gl=GB&uule=w+CAIQIFISCXXeIa8LoNhHEZkq1d1aOpZS",
 postback_data: "html",
 postback_url: "https://your-server.com/postbackscript"
 }
];

axios({
 method: "post",
 url: "https://api.seermartech.cn/v3/serp/google/news/task_post",
 headers: {
 Authorization: "Bearer smt_live_YOUR_KEY",
 "Content-Type": "application/json"
 },
 data: postArray
})
 .then((response) => {
 console.log(response.data);
 })
 .catch((error) => {
 console.error(error);
 });

响应示例

json
{
 "version": "0.1.20200129",
 "status_code": 20000,
 "status_message": "Ok.",
 "time": "0.0818 sec.",
 "cost": 0.0045,
 "tasks_count": 3,
 "tasks_error": 0,
 "tasks": [
 {
 "id": "01291721-1535-0066-0000-9c4f1e7b9f01",
 "status_code": 20100,
 "status_message": "Task Created.",
 "time": "0.0030 sec.",
 "cost": 0.0015,
 "result_count": 0,
 "path": [
 "v3",
 "serp",
 "google",
 "news",
 "task_post"
 ],
 "data": {
 "api": "serp",
 "function": "task_post",
 "se": "google",
 "se_type": "news",
 "language_code": "en",
 "location_code": 2840,
 "keyword": "albert enstein",
 "device": "desktop",
 "os": "windows"
 },
 "result": null
 },
 {
 "id": "01291721-1535-0066-0000-2e7a8bf7302c",
 "status_code": 20100,
 "status_message": "Task Created.",
 "time": "0.0050 sec.",
 "cost": 0.0015,
 "result_count": 0,
 "path": [
 "v3",
 "serp",
 "google",
 "news",
 "task_post"
 ],
 "data": {
 "api": "serp",
 "function": "task_post",
 "se": "google",
 "se_type": "news",
 "language_name": "English",
 "location_name": "United States",
 "keyword": "albert enstein",
 "pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag",
 "tag": "some_string_123",
 "device": "desktop",
 "os": "windows"
 },
 "result": null
 },
 {
 "id": "01291721-1535-0066-0000-ed3110168d43",
 "status_code": 20100,
 "status_message": "Task Created.",
 "time": "0.0040 sec.",
 "cost": 0.0015,
 "result_count": 0,
 "path": [
 "v3",
 "serp",
 "google",
 "news",
 "task_post"
 ],
 "data": {
 "api": "serp",
 "function": "task_post",
 "se": "google",
 "se_type": "news",
 "url": "https://www.google.co.uk/search?q=albert%20einstein&hl=en&gl=GB&uule=w+CAIQIFISCXXeIa8LoNhHEZkq1d1aOpZS",
 "postback_data": "html",
 "postback_url": "https://your-server.com/postbackscript",
 "device": "desktop",
 "os": "windows"
 },
 "result": null
 }
 ]
}

使用建议

  1. 优使用结构化字段 建议优传 keyword + location_code/location_name + language_code/language_name,而不是直接传 url,这样更稳定,也更容易排查问题。

  2. 大批量任务分批提交 单次请求不要 100 个任务。大批量场景建议分批并结合队列控制速率。

  3. 异步获取结果 任务创建接口只返回任务受理状态,result 通常为 null。如需结果,请根据任务 ID 查询,或使用 pingback_url / postback_url

  4. 回调接口做好时与幂等处理 你的回调服务建议支持重复通知处理,并将响应时间控制在 10 秒。

实用场景

  • 监控新闻可见性:按国家/语言定时提交品牌词或产品词任务,追踪品牌是否新闻结果,有助于监测与舆响应。
  • 采集热点新闻版面:围绕行业批量抓取 News SERP,识别高频媒体、新闻标题和版面结构,用于选题与媒体投放分析。
  • 对比不同地区新闻结果:针对同一设置不同 location_code,比较各市场新闻差异,为化 SEO 和区域传播策略提供依据。
  • 构建异步新闻监测流程:结合 postback_urlpingback_url 自动接收任务完成通知,适合搭建新闻报、风险预警或日报系统。
  • 分析新闻结果占位深度:通过 depthmax_crawl_pages 及像素位置参数,评估新闻结果在页面中的层级,判断自然结果被新闻模块挤压的程度。

统一入口:官网 · LLM API · 控制台