主题
Google Finance Explore 实时 HTML 结果
POST /v3/serp/google/finance_explore/live/html
本接口用于实时获取 Google Finance「Explore(探索)」页的原始 HTML。返回结果取决于请求中指定的地区和语言参数。
请求方法与路径:
http
POST https://api.seermartech.cn/v3/serp/wp/v2/live/html> /v3/serp/wp/v2/live/html 为容 API 路径。每次请求只能提交 1 个任务;平台限流以认证说明中的 30/60/120 次/分钟规则为准。
计费说明
每个请求单独计费,示例响应中的 cost 为历史计费字段。示例值 0.003 美对应参考价约 ¥0.0216 / 次。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
请求体使用 UTF-8 编码的 JSON 数组格式:
json
[
{
"language_code": "en",
"location_code": 2840
}
]主要参数
| 参数 | 类型 | 说明 |
|---|---|---|
location_code | integer | 搜索引擎地区代码。未指定 location_name 时填;指定该参数后无需再传 location_name。可通过 /v3/serp/google/locations 获取可用地区代码。例如:2840。 |
language_code | string | 搜索引擎语言代码。未指定 language_name 时填;指定该参数后无需再传 language_name。可通过 /v3/serp/google/languages 获取可用语言代码。例如:en。 |
device | string | 设备类型,可选。可用值:desktop。 |
附加参数
| 参数 | 类型 | 说明 |
|---|---|---|
location_name | string | 搜索引擎地区的完整名称。未指定 location_code 时填;指定该参数后无需再传 location_code。例如:London,England,United Kingdom。 |
language_name | string | 搜索引擎语言的完整名称。未指定 language_code 时填;指定该参数后无需再传 language_code。例如:English。 |
os | string | 设备操作系统,可选。可用值:windows。 |
tag | string | 自定义任务标识,可选,最长 255 个字符。可用于请求与结果;提交的值会原样返回在响应的 data 对象中。 |
news_type | string | 财经新闻筛选类型,可选。可用值:top_stories、local_market、world_markets。默认值:top_stories。 |
响应结构
接口返回 JSON 数据 tasks 任务数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
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 | 任务结果数组。 |
tasks 任务字段
| 字段 | 类型 | 说明 |
|---|---|---|
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 | 请求 URL 路径。 |
data | object | 创建任务时提交的参数。 |
result | array | 任务结果数组。 |
状态码和状态说明的完整列表请参考错误码文档。
result 结果字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 请求中提交的。返回时会对经过 URL 编码的进行解码,字符 + 会被解码为空格。 |
type | string | 请求中的搜索引擎类型。 |
se_domain | string | 请求中的搜索引擎域名。 |
location_code | integer | 地区代码。 |
language_code | string | 语言代码。 |
datetime | string | 接收到结果的日期和时间,使用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。例如:2019-11-15 12:57:46 +00:00。 |
items_count | integer | items 数组中的结果数量。 |
items | array | SERP 中发现的搜索结果。 |
items 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
page | integer | 返回的 HTML 页面序号。 |
date | string | HTML 页面抓取时间,格式为:year-month-date:minutes:UTC_difference_hours:UTC_difference_minutes。例如:2019-11-15 12:57:46 +00:00。 |
html | string | Google Finance Explore 页面的原始 HTML。 |
请求示例
cURL
bash
curl --location --request POST \
"https://api.seermartech.cn/v3/serp/wp/v2/live/html" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"language_code": "en",
"location_code": 2840,
"device": "desktop",
"os": "windows",
"news_type": "top_stories",
"tag": "tag1"
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/serp/wp/v2/live/html"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
payload = [
{
"language_code": "en",
"location_code": 2840,
"device": "desktop",
"os": "windows",
"news_type": "top_stories",
"tag": "tag1",
}
]
response = requests.post(url, headers=headers, json=payload, timeout=60)
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 response = await axios.post(
"https://api.seermartech.cn/v3/serp/wp/v2/live/html",
[
{
language_code: "en",
location_code: 2840,
device: "desktop",
os: "windows",
news_type: "top_stories",
tag: "tag1",
},
],
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
);
console.log(response.data);响应示例
json
{
"version": "0.1.20200130",
"status_code": 20000,
"status_message": "Ok.",
"time": "7.7543 sec.",
"cost": 0.003,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"status_code": 20000,
"status_message": "Ok.",
"time": "7.7543 sec.",
"cost": 0.003,
"result_count": 1,
"path": [
"v3",
"serp",
"wp",
"v2",
"live",
"html"
],
"data": {
"api": "serp",
"function": "live",
"se": "wp",
"se_type": "v2",
"language_name": "English",
"location_name": "United States",
"keyword": "NASDAQ-100",
"tag": "tag1",
"device": "desktop",
"os": "windows"
},
"result": [
{
"keyword": "NASDAQ-100",
"type": "v2",
"se_domain": "google.com",
"location_code": 2840,
"language_code": "en",
"datetime": "2019-11-15 12:57:46 +00:00",
"items_count": 1,
"items": [
{
"page": 1,
"date": "2019-11-15 12:57:46 +00:00",
"html": "<html>...</html>"
}
]
}
]
}
]
}错误处理
建议客户端至少处理以下:
- 检查 HTTP 状态码,识别网络、认证或服务端异常。
- 检查顶层
status_code,确认请求是否成功。 - 检查每个任务的
status_code,单个任务失败被忽略。 - 根据
status_message记录错误原因和排障信息。 - 通过
tasks_error判断本次请求是否失败任务。
成功响应通常使用状态码 20000,完整状态码列表请参考错误码文档。
实用场景
- 抓取财经探索页 HTML:获取指定地区和语言下的 Google Finance Explore 原始页面,用于构建财经搜索结果采集与归档系统。
- 监测市场新闻变化:按
news_type获取头条、本地市场或市场,及时发现财经新闻版位变化。 - 分析金融展现:围绕股票、指数或行业采集页面 HTML,评估金融主题在搜索结果中的呈现。
- 建立竞品财经监控:定期抓取不同地区的财经探索页面,比较竞争品牌、行业和市场的。
- 支持 SEO 页面解析:保存原始 HTML 并进行二次解析,提取标题、链接、模块结构等信息,为金融 SEO 监控和报告生成提供数据。