主题
Google Finance Markets 实时 HTML
本接口用于获取 Google Finance「Markets」标签页的原始 HTML。返回结果会受到请求中 location 与 language 参数的影响,适合需要抓取页面原始结构、自定义解析 DOM 或复现页面展示结果的场景。
接口说明
- 请求方式:
POST - 接口路径:
/v3/serp/wp/v2/live/html - 完整地址:
https://api.seermartech.cn/v3/serp/wp/v2/live/html
说明:
- 单次 Live SERP 请求只提交 1 个任务
- 每分钟最多可发送 2000 次 API 调用
- POST 数据需使用 UTF-8 编码的 JSON 格式
- 请求体为 JSON 数组:
[{ ... }]
计费说明
该接口按请求计费。
参考价约 ¥0.0480 / 次 扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
主要参数
| 字段名 | 类型 | 填 | 说明 |
|---|---|---|---|
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。可通过 /v3/serp/google/locations 获取可用地区名称。示例:London,England,United Kingdom |
language_name | string | 条件填 | 搜索引擎语言完整名称。若未传 language_code,则提供该字段;传后可不再传 language_code。可通过 /v3/serp/google/languages 获取可用语言名称。示例:English |
os | string | 否 | 设备操作系统。可选值:windows |
tag | string | 否 | 自定义任务标识,最长 255 个字符。可用于请求与结果对账;响应中的 data 对象会返回该值 |
market_type | string | 否 | Google Finance 市场类型。可选值:most-active、indexes、indexes/americas、indexes/europe-middle-east-africa、indexes/asia-pacific、gainers、losers、climate-leaders、cryptocurrencies、currencies。默认值:most-active |
返回结果说明
接口返回 JSON 数据,顶层 tasks 数组,用于承载本次创建任务的处理结果。
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码,完整列表参见 /v3/appendix/errors |
status_message | string | 通用状态信息,完整列表参见 /v3/appendix/errors |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总成本,单位 USD |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | 返回错误的任务数量 |
tasks | array | 任务结果数组 |
tasks[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式 |
status_code | integer | 任务状态码,取值范围通常为 10000-60000,完整列表参见 /v3/appendix/errors |
status_message | string | 任务状态信息 |
time | string | 任务执行耗时,单位秒 |
cost | float | 当前任务成本,单位 USD |
result_count | integer | result 数组中的结果数量 |
path | array | 请求路径信息 |
data | object | 回显请求时提交的参数 |
result | array | 结果数组 |
result[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
keyword | string | POST 数组中传的。若 %## 编码会自动解码,+ 会被解码为空格 |
type | string | POST 数组中的搜索引擎类型 |
se_domain | string | POST 数组中的搜索引擎域名 |
location_code | integer | POST 数组中的地区代码 |
language_code | string | POST 数组中的语言代码 |
datetime | string | 结果抓取时间,UTC 格式:yyyy-mm-dd hh-mm-ss +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 |
html | string | 原始 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",
"market_type": "most-active",
"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"
}
data = [
{
"language_code": "en",
"location_code": 2840,
"device": "desktop",
"os": "windows",
"market_type": "most-active",
"tag": "tag1"
}
]
response = requests.post(url, headers=headers, json=data)
print(response.json)TypeScript
typescript
import axios from "axios";
async function main {
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",
market_type: "most-active",
tag: "tag1",
},
],
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
);
console.log(response.data);
}
main.catch(console.error);响应示例
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": [
{
"data": {
"api": "serp",
"function": "live",
"se": "wp",
"se_type": "v2",
"language_name": "English",
"location_name": "United States",
"tag": "tag1",
"device": "desktop",
"os": "windows"
},
"result": [
{
"items": [
{
"page": 1,
"date": "2019-11-15 12:57:46 +00:00",
"html": "<!doctype html>...</html>"
}
]
}
]
}
]
}状态码与错误处理
- 顶层
status_code表示整次请求的处理状态 tasks[].status_code表示单个任务的处理状态- 建议同时检查:
- 顶层
status_code tasks_error- 每个任务的
status_code - 错误码与状态说明请参考:
/v3/appendix/errors
建议在系统中实现异常处理与重试机制,是在批量拉取市场页面、监控不同地区金融展示结果时。
使用说明补
- 本接口返回的是原始 HTML,而不是结构化金融字段
- 如果你需要自行提取涨跌榜、指数模块、币种/汇率列表等,应在业务侧解析
items[].html - 返回与地区、语言、市场类型密切,建议固定参数组合以保证结果可比性
- 单次请求 1 个任务,因此批量抓取时应在客户端按任务逐条发送
实用场景
- 抓取热门市场页:获取
most-active、gainers、losers等页面原始 HTML,用于构建自有金融观察看板或舆源 - 监控地区差异:按不同
location_code和language_code拉取 Markets 页面,比较不同国家/语言环境下的金融展示差异 - 解析加密货币与汇率模块:使用
cryptocurrencies、currencies页面 HTML,自定义抽取币种、汇率和卡片,服务聚合业务 - 跟踪指数栏目结构变化:抓取
indexes/americas、indexes/asia-pacific等页面,监测页面 DOM 或块变化,降低解析规则失效风险 - 验证搜索展示结果:在 SEO 或运营场景中复现特定地区和语言下的 Markets 页面原始输出,排查抓取结果与前端展示不一致的问题