如何获取 JSON 格式的谷歌搜索结果

了解如何通过 SERP API 获取 JSON 格式的 Google Search results,包括常用请求参数、JSON 字段、响应示例,以及 SEO、AI Agent 和 RAG 工作流中的使用方式。

talor ai
Last updated on
3 min read

Google Search results 很有价值,但原始搜索页面并不适合直接给程序使用。

如果你正在做 SEO dashboard、AI Agent、RAG pipeline、竞争对手监测系统或市场研究工具,通常不会想要截图或 raw HTML。你真正需要的是结构化数据:title、URL、snippet、ranking position、domain、result type、location 和 timestamp。

这就是很多团队使用 SERP API 获取 JSON 格式 Google Search results 的原因。

SERP API 可以把搜索 query 转成结构化 response,让你的应用可以存储、过滤、分析,或传给 AI model 使用。

为什么 JSON Search Results 很重要?

JSON 比 HTML 更容易被应用程序处理。

一个 Google results page 可能包含 organic results、ads、local results、images、videos、news、shopping results、People Also Ask、knowledge panels 和其他 SERP features。版面也会因 query、country、language、device 和时间不同而改变。

如果你手动解析页面,就必须持续维护 parser,以应对版面变化。使用 SERP API,response 通常已经被标准化成系统可以理解的字段。

例如,你不需要从页面中解析:

Title, URL, snippet, position, domain, local pack, ads, related results

而是可以直接获取:

{
  "position": 1,
  "title": "Best Project Management Software",
  "url": "https://example.com/project-management",
  "domain": "example.com",
  "snippet": "Compare project management tools for teams and workflows.",
  "result_type": "organic"
}

这样的数据更容易进入 database、dashboard 或 AI workflow。

基本流程

获取 JSON 格式 Google Search results 通常是这样:

Choose a search query
→ Set location, language, and device
→ Send the request to a SERP API
→ Receive structured JSON
→ Store, filter, or analyze the results

常见 request parameters 包括:

参数

作用

query

搜索关键词或短语

engine

搜索引擎,例如 Google

location

国家、城市或市场

language

结果语言

device

Desktop 或 mobile

page / start

分页控制

output

JSON 或 HTML 格式

不同供应商的参数名称可能不同,但核心逻辑一致:先定义搜索上下文,再采集结果。

Talordata SERP API 定位于跨 Google 和其他主要搜索引擎的 real-time SERP data,支持按 successful request 计费、JSON / HTML response formats 和 geo-targeted SERP data,也面向 SEO monitoring、competitor tracking、AI search integration、local SEO、news monitoring 和 e-commerce intelligence 等场景。

API Request 示例

简化后的 request 可能是:

{
  "engine": "google",
  "query": "best CRM software for small business",
  "location": "United States",
  "language": "en",
  "device": "desktop",
  "output": "json"
}

cURL 形式可能像这样:

curl "https://api.example.com/serp?engine=google&q=best%20CRM%20software%20for%20small%20business&location=United%20States&language=en&device=desktop&output=json" \
  -H "Authorization: Bearer YOUR_API_KEY"

正式项目中,API key 应放在 server side,不要暴露在前端 JavaScript 中。

JSON Response 示例

结构化 Google Search JSON response 可能包含 search metadata、request parameters、organic results、related questions、ads、local results 和 pagination data。

例如:

{
  "search_parameters": {
    "engine": "google",
    "query": "best CRM software for small business",
    "location": "United States",
    "language": "en",
    "device": "desktop"
  },
  "organic_results": [
    {
      "position": 1,
      "title": "Best CRM Software for Small Businesses",
      "url": "https://example.com/best-crm",
      "domain": "example.com",
      "snippet": "Compare CRM tools by pricing, automation, integrations, and team size.",
      "result_type": "organic"
    }
  ],
  "related_questions": [
    {
      "question": "What is the best CRM for a small business?"
    }
  ]
}

对大多数应用来说,最重要的字段是:

  • Query

  • Location

  • Language

  • Device

  • Position

  • Title

  • URL

  • Domain

  • Snippet

  • Result type

  • Timestamp

这些字段能让结果可追溯。没有搜索上下文,排名数据很难正确解读。

如何使用 JSON Data

SEO Rank Tracking

对 SEO 来说,JSON search results 可以用来追踪 keyword positions。

你可以保存 query、location、device、position、URL、domain 和 timestamp,回答这些问题:

  • 哪些页面在某个 keyword 下排名?

  • 我们的 domain 上升还是下降?

  • 哪些竞争对手更常出现?

  • 排名是否因 country 或 device 不同?

  • 哪些 SERP features 出现在这个 keyword 下?

AI Agents

AI agents 需要新鲜 Web context。

模型可能知道通用信息,但不一定知道今天的价格、新产品页、突发新闻或当前竞争对手排名。JSON search results 可以帮助 Agent 先发现来源,再决定抓取哪些页面。

好的 Agent workflow 是:

Search query
→ Receive JSON results
→ Filter by relevance and domain quality
→ Fetch only selected URLs
→ Use the content for grounded answers

这可以避免盲目抓取所有页面。

RAG Pipelines

对 RAG 来说,JSON 格式 Google Search results 可以作为 source discovery layer。

你可以搜索新来源、去重 URL、抓取选定页面、切分内容、生成 embeddings,并存入 vector database。

JSON response 应保留 source URL、domain、snippet 和 timestamp,让系统之后能说明信息来源。

常见错误

第一个错误,是不带 location 采集结果。Google results 会因 country、city、language 和 device 不同。

第二个错误,是只保存 URL。你还应保存 position、title、snippet、query、location 和 timestamp。

第三个错误,是抓取每个结果页。对很多 AI workflow 来说,top 3–5 个高质量来源已经足够。

第四个错误,是把 snippet 当成完整证据。Snippet 适合快速筛选,但重要答案应基于完整来源页面。

第五个错误,是忽略成本。大量 query variations 和 locations 会让成本快速上升。

选择 SERP API 前应比较什么?

选择 provider 前,应使用真实 query 测试。

比较因素

应检查什么

JSON structure

字段是否容易解析

Field completeness

title、URL、snippet、position 是否稳定

Location control

是否能指定需要的市场

Result types

Organic、ads、news、local、shopping、images

Freshness

Real-time 还是 cached results

Cost model

Per request、per response 或 successful request

Integration

Docs、examples、error handling

Workflow fit

SEO、AI agents、RAG、monitoring、research

你可以 从 1000 次免费响应开始测试 >>,或先 查看 SERP API query parameters 再搭建正式工作流。

结语

获取 JSON 格式的 Google Search results,不只是 scraping task,而是一个 data workflow。

目标不只是拿到结果,而是取得结构化、可靠、带地理上下文,且系统真正能使用的搜索数据。

对 SEO 团队来说,这意味着 rankings、competitors、SERP features 和 historical trends。

对 AI agents 来说,这意味着 fresh sources、clean URLs、snippets 和 citation-ready context。

对 RAG pipelines 来说,这意味着发现当前来源,并保存 metadata 以便后续 retrieval。

好的 SERP API 应该减少解析工作,支持 location 和 language control,返回稳定 JSON fields,让团队专注于分析,而不是维护脆弱的 scraper。

Scale Your Data
Operations Today.

Join the world's most robust proxy network.

Start Free Trial