主题
Gemini LLM 实时抓取(高级版)
POST /v3/ai_optimization/gemini/llm_scraper/live/advanced
接口说明
POST /v3/ai_optimization/gemini/llm_scraper/live/advanced
本接口用于实时获取 Gemini 的结构化回答结果。返回会根据指定的搜索位置、语言和生成,并可能 Markdown 文本、引用来源、表格及图片等结果类型。
- 请求方式:
POST - 请求地址:
https://api.seermartech.cn/v3/ai_optimization/gemini/llm_scraper/live/advanced - 请求格式:JSON(UTF-8)
- 单次请求最多 1 个任务 平台限流以认证说明中的 30/60/120 次/分钟规则为准
- 单个任务最长执行时间目前为 120 秒
- 请求体是 JSON 数组:
[{ ... }]
计费说明
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
请求体中的每个对象代表一个任务。
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
keyword 平台限流以认证说明中的 30/60/120 次/分钟规则为准个字符。参数中的编码会被解码,+ 会被解码为空格。若中需要使用 %,请写为 %25;需要使用 +,请写为 %2B。 | |||
location_name | string | 条件填 | 搜索位置的完整名称。当未指定 location_code 或 location_coordinate 时填。使用此参数后,无需再传位置参数。 |
location_code | integer | 条件填 | 搜索位置代码。当未指定 location_name 或 location_coordinate 时填。使用此参数后,无需再传位置参数。 |
location_coordinate | string | 条件填 | 位置 GPS 坐标,格式为 纬度,经度,半径。纬度和经度最多支持 7 位小数;半径最小值为 199 毫米,最大值为 199999 毫米。使用此参数后,无需再传位置参数。 |
language_name | string | 条件填 | 搜索语言的完整名称。当未指定 language_code 时填。使用此参数后,无需再传语言代码。 |
language_code | string | 条件填 | 搜索语言代码。当未指定 language_name 时填。使用此参数后,无需再传语言名称。 |
tag | string | 否 | 用户自定义任务标识,最多 255 个字符。可用于匹任务与结果,提交的值会在响应任务的 data 对象中返回。 |
位置参数互斥规则
以下三种位置参数且只能选择一种:
location_namelocation_codelocation_coordinate
可通过以下接口获取可用位置及名称、代码:
GET https://api.seermartech.cn/v3/ai_optimization/gemini/llm_scraper/locations
示例:
text
location_name: United States
location_code: 2840
location_coordinate: 53.476225,-2.243572,200语言参数互斥规则
以下两种语言参数且只能选择一种:
language_namelanguage_code
可通过以下接口获取可用语言及名称、代码:
GET https://api.seermartech.cn/v3/ai_optimization/gemini/llm_scraper/languages
示例:
text
language_name: English
language_code: en请求示例
json
[
{
"language_code": "en",
"location_code": 2840,
"keyword": "albert einstein",
"tag": "demo-task"
}
]响应结构
响应为 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 | 任务结果数组。 |
任务字段
| 字段 | 类型 | 说明 |
|---|---|---|
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 | 请求路径信息。 |
data | object | 提交任务时使用的参数 keyword、位置、语言及 tag 等。 |
result | array | Gemini 返回的结果数组。 |
结果字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 请求中的。返回时已对编码进行解码,+ 会显示为空格。 |
location_code | integer | 请求中的位置代码。 |
language_code | string | 请求中的语言代码。 |
model | string | 使用的 Gemini 模型版本。 |
datetime | string | 结果接收时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。 |
markdown | string | 以 Markdown 格式返回的完整回答。 |
sources | array | 模型在最终回答中引用或参考的来源。 |
se_results_count | integer | 结果总数。 |
item_types | array | 结果类型列表,可能 gemini_text、gemini_table、gemini_images。 |
items_count | integer | items 数组中的数量。 |
items | array | Gemini 返回的详细结果。 |
sources 来源字段
result.sources 以及部分 items素中可能来源数组。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 来源类型,固定为 gemini_source。 |
title | string | 来源标题。 |
snippet | string | 来源描述或摘要。 |
domain | string | 来源域名。 |
url | string | 来源 URL。 |
thumbnail | string | 来源缩略图 URL。 |
source_name | string | 来源名称。 |
publication_date | string | 来源发布时间,格式为 yyyy-mm-dd hh:mm:ss +00:00。 |
markdown | string | 以 Markdown 格式表示的来源。 |
items 结果
gemini_text
表示 Gemini 返回的文本。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 gemini_text。 |
rank_group | integer | 同类型结果中的分组排名。不同类型不会计该字段的排名。 |
rank_absolute | integer | 在所有 SERP素中的绝对排名。 |
markdown | string | Markdown 格式的文本。 |
original_text | string | 未格式化的原始文本。 |
sources | array | 该文本的来源数组,字段结构同 sources。 |
gemini_table
表示 Gemini 返回的表格。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 gemini_table。 |
rank_group | integer | 同类型结果中的分组排名。 |
rank_absolute | integer | 在所有 SERP素中的绝对排名。 |
markdown | string | Markdown 格式的表格。 |
original_text | string | 未格式化的原始文本。 |
table | object | 表格结构。 |
table.table_header | array | 表头。 |
table.table_content | array | 表格。每个数组代表一行。 |
gemini_images
表示 Gemini 返回的图片结果。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 gemini_images。 |
rank_group | integer | 同类型结果中的分组排名。 |
rank_absolute | integer | 在所有 SERP素中的绝对排名。 |
markdown | string | Markdown 格式的图片。 |
items | array | 图片数组。 |
gemini_images.items 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 gemini_images_element。 |
url | string | 图片页面 URL。 |
alt | string | 图片的替代文本。 |
image_url | string | 图片 URL。该地址可能指向原始资源,也可能指向本平台存储的图片。 |
markdown | string | Markdown 格式的图片。 |
响应示例
json
{
"version": "0.1.20260218",
"status_code": 20000,
"status_message": "Ok.",
"time": "27.1013 sec.",
"cost": 0.004,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "00000000-0000-0000-0000-000000000001",
"status_code": 20000,
"status_message": "Ok.",
"time": "27.1013 sec.",
"cost": 0.004,
"result_count": 1,
"path": [
"v3",
"ai_optimization",
"gemini",
"llm_scraper",
"live",
"advanced"
],
"data": {
"api": "ai_optimization",
"function": "llm_scraper",
"se": "gemini",
"language_code": "en",
"location_code": 2840,
"keyword": "albert einstein",
"device": "desktop",
"os": "windows",
"tag": "demo-task"
},
"result": [
{
"keyword": "albert einstein",
"location_code": 2840,
"language_code": "en",
"model": "gemini",
"datetime": "2026-02-18 12:57:46 +00:00",
"markdown": "Albert Einstein was a German-born theoretical physicist...",
"sources": [
{
"type": "gemini_source",
"title": "Albert Einstein",
"snippet": "Biography and scientific contributions.",
"domain": "example.org",
"url": "https://example.org/albert-einstein",
"thumbnail": "https://example.org/image.jpg",
"source_name": "Example Source",
"publication_date": "2026-02-18 10:00:00 +00:00",
"markdown": "[Albert Einstein](https://example.org/albert-einstein)"
}
],
"se_results_count": 0,
"item_types": [
"gemini_text",
"gemini_table",
"gemini_images"
],
"items_count": 3,
"items": [
{
"type": "gemini_text",
"rank_group": 1,
"rank_absolute": 1,
"markdown": "Einstein's major contributions include relativity and the photoelectric effect.",
"original_text": "Einstein's major contributions include relativity and the photoelectric effect.",
"sources": []
},
{
"type": "gemini_table",
"rank_group": 1,
"rank_absolute": 2,
"markdown": "| Aspect | Detail |\n|---|---|\n| Nobel Prize | Physics (1921) |",
"original_text": "Aspect Detail Nobel Prize Physics (1921)",
"table": {
"table_header": [
"Aspect",
"Detail"
],
"table_content": [
[
"Nobel Prize",
"Physics (1921)"
]
]
}
},
{
"type": "gemini_images",
"rank_group": 1,
"rank_absolute": 3,
"markdown": "",
"items": [
{
"type": "gemini_images_element",
"url": "https://example.org/albert-einstein",
"alt": "Albert Einstein",
"image_url": "https://example.org/image.jpg",
"markdown": ""
}
]
}
]
}
]
}
]
}错误处理
请根据响应中的以下字段判断请求是否成功:
- 顶层
status_code - 任务级
tasks[].status_code - 对应的
status_message
当状态码不为 20000 时,应记录错误码和错误信息,并根据业务需要进行重试、告警或人工处理。完整错误码列表请参考 /v3/appendix/errors。
调用示例
cURL
bash
curl --location --request POST \
"https://api.seermartech.cn/v3/ai_optimization/gemini/llm_scraper/live/advanced" \
--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/advanced"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
# 单次请求只能提交一个任务
payload = [
{
"language_code": "en",
"location_code": 2840,
"keyword": "albert einstein",
}
]
response = requests.post(url, headers=headers, json=payload, timeout=120)
result = response.json()
if result.get("status_code") == 20000:
print(result)
else:
print(
f"请求失败,错误码:{result.get('status_code')},"
f"错误信息:{result.get('status_message')}"
)TypeScript
typescript
import axios from "axios";
const url =
"https://api.seermartech.cn/v3/ai_optimization/gemini/llm_scraper/live/advanced";
const payload = [
{
language_code: "en",
location_code: 2840,
keyword: "albert einstein",
},
];
axios
.post(url, payload, {
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
timeout: 120000,
})
.then((response) => {
// 读取结构化结果
console.log(response.data);
})
.catch((error) => {
console.error("请求失败:", error.response?.data || error.message);
});实用场景
- 采集指定国家和语言下的 Gemini 回答,评估品牌或产品在生成式搜索结果中的表现。
- 提取 Gemini 引用的来源页面,分析竞争对手被引用的资产和外链机会。
- 解析文本、表格和图片结果,构建生成式搜索结果监测报表或归档系统。
- 按、位置和语言批量执行实时查询,对比不同市场中的搜索意图和 AI 回答差异。
- 保存
model、datetime和排名字段,持续追踪 Gemini 模型回答及引用结果的变化趋势。