Skip to content

Gemini LLM 抓取结果 HTML(实时)

POST /v3/ai_optimization/gemini/llm_scraper/live/html

本接口用于按指定关键词、语言和地域,实时获取 Gemini LLM 抓取结果的原始 HTML 页面。

接口返回的是 HTML 原文,适合用于页面结构分析、结果验证、引用来源展示还原等场景。

接口地址

POST https://api.seermartech.cn/v3/ai_optimization/gemini/llm_scraper/live/html

计费说明

该接口按请求计费,每次请求都会产生费用。

参考价约 ¥0.0640 / 次 扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求说明

  • 请求方式:POST
  • 请求体格式:JSON
  • 编码:UTF-8
  • 请求体为 JSON 数组格式:[{ ... }]
  • 每次 Live LLM Scraper 请求只能 1 个任务
  • 最高请求频率:2000 次/分钟

任务请求参数

字段名类型说明
keywordstring。,最长支持 2000 个字符%## 会被解码,字符 + 会被解码为空格。如果中需要保留 %,请写为 %25;如果需要保留 +,请写为 %2B
location_namestring搜索地域完整名称。当未提供 location_codelocation_coordinate 时填。使用该字段时,无需再传 location_codelocation_coordinate。示例:United States
location_codeinteger搜索地域编码。当未提供 location_namelocation_coordinate 时填。使用该字段时,无需再传 location_namelocation_coordinate。示例:2840
location_coordinatestringGPS 坐标位置。当未提供 location_namelocation_code 时填。格式为 "latitude,longitude,radius"。纬度和经度最多支持 7 位小数;radius 最小值为 199(毫米),最大值为 199999(毫米)。示例:53.476225,-2.243572,200
language_namestring搜索语言完整名称。当未提供 language_code 时填。使用该字段时,无需再传 language_code。示例:English
language_codestring搜索语言代码。当未提供 language_name 时填。使用该字段时,无需再传 language_name。示例:en
expand_citationsboolean可选。是否在 HTML 结果中返回展开后的引用栏。启用后,接口将返回引用区域展开后的 HTML。默认值:false
tagstring可选。自定义任务标识,最长 255 个字符。可用于请求与结果的对应匹。返回结果中的 data 对象会带回该值。

语言与地域列表

可通过以下容路径获取可用语言和地域:

  • 地域列表:/v3/ai_optimization/gemini/llm_scraper/locations
  • 语言列表:/v3/ai_optimization/gemini/llm_scraper/languages

响应结构

接口返回 JSON 数据,顶层 tasks 数组。

顶层字段

字段名类型说明
versionstring当前 API 版本
status_codeinteger通用状态码。完整错误码可参考 /v3/appendix/errors
status_messagestring通用状态信息
timestring执行耗时,单位秒
costfloat本次请求总费用,单位 USD
tasks_countintegertasks 数组中的任务数量
tasks_errorintegertasks 数组中返回错误的任务数量
tasksarray任务结果数组

tasks 数组字段

字段名类型说明
idstring任务唯一标识,UUID 格式
status_codeinteger任务状态码,范围通常为 10000-60000,完整列表参考 /v3/appendix/errors
status_messagestring任务状态信息
timestring任务执行耗时,单位秒
costfloat任务费用,单位 USD
result_countintegerresult 数组中的结果数量
patharray请求路径
dataobject与请求中提交的参数基本一致
resultarray结果数组

result 数组字段

字段名类型说明
keywordstring请求中的。返回时 %## 会被解码,+ 会被解码为空格
location_codeinteger请求中的地域编码
language_codestring请求中的语言代码
datetimestring获取结果的时间,UTC 格式:yyyy-mm-dd hh:mm:ss +00:00
items_countintegeritems 数组中的结果数量
itemsarray抓取结果项

items 数组字段

字段名类型说明
pageinteger返回的 HTML 页序号
datestringHTML 页面抓取时间,格式示例:2019-11-15 12:57:46 +00:00
htmlstring原始 HTML 页面

请求示例

cURL

bash
curl --location --request POST "https://api.seermartech.cn/v3/ai_optimization/gemini/llm_scraper/live/html" \
--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/ai_optimization/gemini/llm_scraper/live/html"
headers = {
 "Authorization": "Bearer smt_live_YOUR_KEY",
 "Content-Type": "application/json"
}
data = [
 {
 "language_code": "en",
 "location_code": 2840,
 "keyword": "albert einstein"
 }
]

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/ai_optimization/gemini/llm_scraper/live/html",
 [
 {
 language_code: "en",
 location_code: 2840,
 keyword: "albert einstein",
 },
 ],
 {
 headers: {
 Authorization: "Bearer smt_live_YOUR_KEY",
 "Content-Type": "application/json",
 },
 }
 );

 console.log(response.data);
}

main.catch(console.error);

响应示例

json
{
 "version": "0.1.20260209",
 "status_code": 20000,
 "status_message": "Ok.",
 "time": "25.1849 sec.",
 "cost": 0.004,
 "tasks_count": 1,
 "tasks_error": 0,
 "tasks": [
 {
 "data": {
 "api": "ai_optimization",
 "function": "llm_scraper",
 "se": "gemini",
 "language_code": "en",
 "location_code": 2840,
 "keyword": "albert einstein",
 "postback_data": "html",
 "device": "desktop",
 "os": "windows"
 },
 "result": [
 {
 }
 ]
 }
 ]
}

错误处理

  • 顶层 status_code 表示整次请求的处理状态
  • tasks[].status_code 表示单个任务的执行状态
  • 建议同时处理 HTTP 状态码与业务状态码
  • 完整错误码与状态说明可参考:/v3/appendix/errors

常见处理建议:

  • 20000:请求成功
  • 20000:根据 status_message 和错误码执行重试、参数修正或告警
  • tasks_error 大于 0 时,应逐个检查 tasks 中失败任务

使用说明补

  1. keyword 支持较长文本,但需注意 %+ 的编码规则。
  2. 地域参数三选一:location_namelocation_codelocation_coordinate
  3. 语言参数二选一:language_namelanguage_code
  4. 若需要抓取带有展开引用栏的结果页面,请将 expand_citations 设为 true
  5. 本接口返回的是原始 HTML,而不是结构化摘要结果,适合后续自行解析。

实用场景

  • 抓取结果页原文:获取指定在目标语言与地域下的原始 HTML,用于还原展示并做人工质检。
  • 分析引用来源展示:启用 expand_citations 后提取展开引用栏,识别答案引用的网站与页面来源,策略制定。
  • 监测地域差异:对同一按不同 location_code 拉取 HTML,比较不同国家/地区的结果页差异,支持 SEO 决策。
  • 验证语言版本输出:按不同 language_code 获取页面原文,检查多语言结果呈现是否一致,化投放。
  • 构建自定义解析器:基于返回的 HTML 自行抽取模块、引用、卡片和页面结构特征,形成可视化监控或竞品分析能力。

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