Skip to content

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_namestring条件填搜索位置的完整名称。当未指定 location_codelocation_coordinate 时填。使用此参数后,无需再传位置参数。
location_codeinteger条件填搜索位置代码。当未指定 location_namelocation_coordinate 时填。使用此参数后,无需再传位置参数。
location_coordinatestring条件填位置 GPS 坐标,格式为 纬度,经度,半径。纬度和经度最多支持 7 位小数;半径最小值为 199 毫米,最大值为 199999 毫米。使用此参数后,无需再传位置参数。
language_namestring条件填搜索语言的完整名称。当未指定 language_code 时填。使用此参数后,无需再传语言代码。
language_codestring条件填搜索语言代码。当未指定 language_name 时填。使用此参数后,无需再传语言名称。
tagstring用户自定义任务标识,最多 255 个字符。可用于匹任务与结果,提交的值会在响应任务的 data 对象中返回。

位置参数互斥规则

以下三种位置参数且只能选择一种:

  • location_name
  • location_code
  • location_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_name
  • language_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 任务数组。

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger通用状态码。完整状态码列表请参考错误码文档。
status_messagestring通用状态信息。
timestring请求执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务总数。
tasks_errorintegertasks 数组中返回错误的任务数。
tasksarray任务结果数组。

任务字段

字段类型说明
idstring任务唯一标识,UUID 格式。
status_codeinteger任务状态码,通常在 1000060000 范围。
status_messagestring任务状态信息。
timestring任务执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegerresult 数组中的结果数量。
patharray请求路径信息。
dataobject提交任务时使用的参数 keyword、位置、语言及 tag 等。
resultarrayGemini 返回的结果数组。

结果字段

字段类型说明
keywordstring请求中的。返回时已对编码进行解码,+ 会显示为空格。
location_codeinteger请求中的位置代码。
language_codestring请求中的语言代码。
modelstring使用的 Gemini 模型版本。
datetimestring结果接收时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00
markdownstring以 Markdown 格式返回的完整回答。
sourcesarray模型在最终回答中引用或参考的来源。
se_results_countinteger结果总数。
item_typesarray结果类型列表,可能 gemini_textgemini_tablegemini_images
items_countintegeritems 数组中的数量。
itemsarrayGemini 返回的详细结果。

sources 来源字段

result.sources 以及部分 items素中可能来源数组。

字段类型说明
typestring来源类型,固定为 gemini_source
titlestring来源标题。
snippetstring来源描述或摘要。
domainstring来源域名。
urlstring来源 URL。
thumbnailstring来源缩略图 URL。
source_namestring来源名称。
publication_datestring来源发布时间,格式为 yyyy-mm-dd hh:mm:ss +00:00
markdownstring以 Markdown 格式表示的来源。

items 结果

gemini_text

表示 Gemini 返回的文本。

字段类型说明
typestring固定为 gemini_text
rank_groupinteger同类型结果中的分组排名。不同类型不会计该字段的排名。
rank_absoluteinteger在所有 SERP素中的绝对排名。
markdownstringMarkdown 格式的文本。
original_textstring未格式化的原始文本。
sourcesarray该文本的来源数组,字段结构同 sources

gemini_table

表示 Gemini 返回的表格。

字段类型说明
typestring固定为 gemini_table
rank_groupinteger同类型结果中的分组排名。
rank_absoluteinteger在所有 SERP素中的绝对排名。
markdownstringMarkdown 格式的表格。
original_textstring未格式化的原始文本。
tableobject表格结构。
table.table_headerarray表头。
table.table_contentarray表格。每个数组代表一行。

gemini_images

表示 Gemini 返回的图片结果。

字段类型说明
typestring固定为 gemini_images
rank_groupinteger同类型结果中的分组排名。
rank_absoluteinteger在所有 SERP素中的绝对排名。
markdownstringMarkdown 格式的图片。
itemsarray图片数组。

gemini_images.items 字段

字段类型说明
typestring固定为 gemini_images_element
urlstring图片页面 URL。
altstring图片的替代文本。
image_urlstring图片 URL。该地址可能指向原始资源,也可能指向本平台存储的图片。
markdownstringMarkdown 格式的图片。

响应示例

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": "![Einstein](https://example.org/image.jpg)",
              "items": [
                {
                  "type": "gemini_images_element",
                  "url": "https://example.org/albert-einstein",
                  "alt": "Albert Einstein",
                  "image_url": "https://example.org/image.jpg",
                  "markdown": "![Albert Einstein](https://example.org/image.jpg)"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

错误处理

请根据响应中的以下字段判断请求是否成功:

  • 顶层 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 回答差异。
  • 保存 modeldatetime 和排名字段,持续追踪 Gemini 模型回答及引用结果的变化趋势。

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