主题
设置 Google Finance Explore SERP 任务
POST /v3/serp/google/finance_explore/task_post
本接口使用 POST 方法设置 Google Finance Explore SERP 任务:
POST https://api.seermartech.cn/v3/serp/google/finance_explore/task_post
Google Finance Explore API 用于获取 Google Finance「探索」标签页中的实时数据。返回结果取决于请求中的地区和语言参数 location_code、location_name、language_code 和 language_name。
计费与请求限制
每个任务都会产生费用。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求要求如下:
- 请求体使用 UTF-8 编码的 JSON 数组。
- 每次 POST 请求最多 100 个任务。 平台限流以认证说明中的 30/60/120 次/分钟规则为准。
- 如果单次请求 100 个任务,出限制的任务将返回错误码
40006。 - 任务完成后,可以通过任务唯一标识
id获取结果。 - 也可以在创建任务时指定
pingback_url或postback_url,由本平台在任务完成后主动通知。 - 如果接收通知的服务器在 10 秒未响应,连接将因时中断,任务会转移到任务就绪列表。
请求参数
主要参数
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
location_code | integer | 条件填 | 搜索引擎地区代码。未指定 location_name 时提供。提供该参数后无需再提供 location_name。可通过 GET https://api.seermartech.cn/v3/serp/google/locations 获取可用地区代码。例如:2840。 |
language_code | string | 条件填 | 搜索引擎语言代码。未指定 language_name 时提供。提供该参数后无需再提供 language_name。可通过 GET https://api.seermartech.cn/v3/serp/google/languages 获取可用语言代码。例如:en。 |
device | string | 否 | 设备类型。可选值:desktop。 |
pingback_url | string | 否 | 任务完成通知地址。任务完成后,本平台会向该地址发送 GET 请求。URL 中可以使用 $id 和 $tag 占位符,本平台发送请求前会替换为任务 ID 和经过 URL 编码的标签值。例如:https://your-server.com/pingscript?id=$id&tag=$tag。特殊字符会进行 URL 编码,例如 # 会编码为 %23。 |
postback_url | string | 否 | 任务结果回调地址。任务完成后,本平台会向该地址发送任务结果的 POST 请求,结果使用 gzip 压缩。URL 中可以使用 $id 和 $tag 占位符。例如:https://your-server.com/postbackscript?id=$id&tag=$tag。 |
postback_data | string | 条件填 | 当指定 postback_url 时提供。用于指定发送到服务器的数据类型。可选值:advanced、html。 |
priority | integer | 否 | 任务优级。可选值:1(普通,默认值)、2(高优级)。高优级任务可能产生额外费用,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。 |
附加参数
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
location_name | string | 条件填 | 搜索引擎地区名。未指定 location_code 时提供。提供该参数后无需再提供 location_code。可通过 GET https://api.seermartech.cn/v3/serp/google/locations 获取可用地区名称。例如:London,England,United Kingdom。 |
language_name | string | 条件填 | 搜索引擎语言名。未指定 language_code 时提供。提供该参数后无需再提供 language_code。可通过 GET https://api.seermartech.cn/v3/serp/google/languages 获取可用语言名称。例如:English。 |
os | string | 否 | 设备操作系统。可选值:windows。 |
tag | string | 否 | 用户自定义任务标识,最长 255 个字符。可用于任务与结果。提交的值会原样返回在响应任务的 data 对象中。 |
news_type | string | 否 | 财经新闻筛选类型。可选值:top_stories、local_market、world_markets。默认值为 top_stories。当设置为 local_market 或 world_markets 时,每个任务的计费可能按 2 倍计算,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。 |
> location_code 与 location_name 二选一;language_code 与 language_name 二选一。
请求示例
curl
bash
curl --location --request POST \
"https://api.seermartech.cn/v3/serp/google/finance_explore/task_post" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"location_code": 2840,
"language_name": "English"
},
{
"location_code": 2840,
"language_name": "English",
"priority": 2,
"tag": "some_string_123",
"pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag"
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/serp/google/finance_explore/task_post"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
# 请求体是 JSON 数组,每个代表一个任务
post_data = [
{
"location_code": 2840,
"language_name": "English",
},
{
"location_code": 2840,
"language_name": "English",
"priority": 2,
"tag": "some_string_123",
"pingback_url": (
"https://your-server.com/pingscript"
"?id=$id&tag=$tag"
),
},
]
response = requests.post(url, headers=headers, json=post_data, timeout=30)
result = response.json()
if result.get("status_code") == 20000:
print(result)
else:
print(
"请求失败,错误码:%s,错误信息:%s"
% (result.get("status_code"), result.get("status_message"))
)TypeScript
typescript
import axios from "axios";
const postData = [
{
location_code: 2840,
language_name: "English",
},
{
location_code: 2840,
language_name: "English",
priority: 2,
tag: "some_string_123",
pingback_url:
"https://your-server.com/pingscript?id=$id&tag=$tag",
},
];
axios
.post(
"https://api.seermartech.cn/v3/serp/google/finance_explore/task_post",
postData,
{
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);
});响应结构
接口返回 JSON 数据任务提交状态和 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 请求级状态码。成功时通常为 20000。完整错误码请参考错误码文档。 |
status_message | string | 请求级状态说明。 |
time | string | 请求执行耗时,例如 0.0546 sec.。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务总数。 |
tasks_error | integer | tasks 数组中提交失败的任务数量。 |
tasks | array | 已提交任务的信息数组。 |
tasks 对象字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,采用 UUID 格式。后续可使用该 ID 查询任务结果。 |
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 | 任务结果数组。对于任务创建接口,该字段通常为 null。 |
响应示例
json
{
"version": "0.1.20241227",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0546 sec.",
"cost": 0.0024,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": " UUID-任务标识 ",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0213 sec.",
"cost": 0.0024,
"result_count": 0,
"path": [
"v3",
"serp",
"google",
"finance_explore",
"task_post"
],
"data": {
"api": "serp",
"function": "task_post",
"se": "google",
"se_type": "finance_explore",
"language_name": "English",
"location_code": 2840,
"news_type": "local_market",
"priority": 2,
"device": "desktop",
"os": "windows"
},
"result": null
}
]
}任务结果获取
任务创建成功后,请保存响应中的 tasks[].id,并使用该 ID 查询已完成的任务结果。也可以在创建任务时:
pingback_url:任务完成后接收 GET 通知。postback_url:任务完成后接收 gzip 压缩的 POST 结果。
如果回调服务器未在 10 秒响应,任务会被转移到任务就绪列表,之后应通过任务 ID 主动获取结果。
实用场景
- 监测不同地区的 Google Finance 探索结果,对比市场新闻与金融信息在不同国家或地区的展示差异,支持化 SEO 和市场研究。
- 批量采集财经新闻筛选结果,分别分析
top_stories、local_market和world_markets,团队制定财经资讯选题策略。 - 按设备维度验证 SERP 展示,检查桌面端 Google Finance 结果在目标市场中的呈现,支持搜索结果监控和竞品分析。
- 通过任务标签数据处理流程,使用
tag将任务与项目、客户或采集批次绑定,降低异步结果归档和数据洗成本。 - 利用回调机制构建实时数据管道,通过
pingback_url或postback_url在任务完成后自动触发库、告警或报表更新。