Google 将于2027年1月1日停止Custom Search API服务
摘要
Google 将于2027年1月1日停止其Custom Search API服务,开发者有9个月时间迁移到替代解决方案。本文详细介绍了迁移步骤、代码示例以及对现有集成的影响。
暂无内容
查看缓存全文
缓存时间: 2026/07/17 01:54
# Google 将于2027年1月1日停用自定义搜索 API。你还有9个月 - The Next Gen Nexus
来源:https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/
阅读时间:12分钟
- Google 将于2027年1月1日停用自定义搜索 API。你还有9个月 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Google_Kills_Custom_Search_API_on_Jan_1_2027_You_Have_9_Months)
- 为什么 CSE 很重要 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Why_CSE_mattered)
- 当前 CSE JSON 格式 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#The_current_CSE_JSON_shape)
- 新旧功能对比矩阵 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Old_vs_new_the_feature_parity_matrix)
- CSE 配额数学(比你想象的要奇怪) (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#CSE_quota_math_its_weirder_than_you_think)
- 架构 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Architecture)
- 迁移:只需修改两行代码 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Migration_the_two-line_change)
- 代码示例 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Code_examples)
- Python:RAG 管道迁移 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Python_RAG_pipeline_migration)
- curl:一次性快速搜索 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#curl_quick_one-off_search)
- Node.js:站点范围的营销网站搜索 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Nodejs_site-scoped_marketing_site_search)
- Python:研究查询的分页 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Python_pagination_for_research_queries)
- curl:图片搜索 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#curl_image_search)
- 实例:一个20人法律研究团队的引用验证机器人 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Worked_example_a_citation-verification_bot_for_a_20-person_legal_research_team)
- 迁移清单 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#The_migration_checklist)
- 速率限制与并发 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Rate_limits_and_concurrency)
- 注意事项 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Gotchas)
- 常见问题 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#FAQ)
- Google 真的会关闭 CSE 吗? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Is_Google_definitely_shutting_CSE_down)
- 我还能在网站上保留 CSE UI 组件吗? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Can_I_keep_using_the_CSE_UI_widget_on_my_site)
- 抓取 Google SERP 合法吗? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Is_scraping_Google_SERP_legal)
- 如果 Google 检测到抓取并封锁我们,会怎样? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#What_happens_if_Google_detects_the_scraping_and_blocks_us)
- 该 actor 是否支持可编程搜索引擎的“优化”功能? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Does_the_actor_support_Programmable_Search_Engines_%E2%80%9CRefinements%E2%80%9D_feature)
- 与 CSE 相比,延迟如何? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Whats_the_latency_compared_to_CSE)
- 我可以缓存结果吗? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Can_I_cache_results)
- 如果 Google 封锁 SERP 抓取,该 actor 还能存活吗? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Will_the_actor_survive_if_Google_locks_down_SERP_scraping)
- 下一步 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Whats_next)
- 结论 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Conclusion)
- 常见问题解答 (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Frequently_asked_questions)
- Google Custom Search API 何时关闭? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#When_is_the_Google_Custom_Search_API_being_shut_down)
- 什么会取代 Google Custom Search JSON API? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#What_replaces_the_Google_Custom_Search_JSON_API)
- 如何从 Google Custom Search API 迁移? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#How_do_I_migrate_off_Google_Custom_Search_API)
- 没有 Custom Search API 我还能获取 Google 搜索结果吗? (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Can_I_get_Google_search_results_without_the_Custom_Search_API)
- 相关文章: (https://thenextgennexus.com/2026/05/14/google-kills-custom-search-api-on-jan-1-2027-you-have-9-months/#Related_posts)
## Google 将于2027年1月1日停用自定义搜索 API。你还有9个月
Google Custom Search 已于2027年1月1日死亡。这是操作手册。
截至本文写作时的2026年8月,该API仍在技术上运行。关停通知于2026年1月在一篇安静的 Google 开发者博客文章和一批控制台电子邮件通知中发布。CSE JSON API——自2006年以来每个独立开发者、研究团队、学术机构以及小型SaaS公司都依赖的“以JSON形式给我Google结果”的接口——将在2027年1月1日返回 HTTP 410 Gone。你还有大约九个月时间。
Google 推荐的替代品是 Vertex AI Search,这是一个完全不同的产品:一个企业级的“基于自有语料库构建你自己的语义搜索”服务,其定价结构从基本层每1000次查询约2美元起,并随扩展快速上涨。它不是 CSE 的替代品。它不返回 CSE 曾经返回的公共网络搜索结果。Google 的官方立场是,对于“大规模网络搜索”,开发者应该“探索第三方提供商”——这用企业语言翻译过来就是“我们不做这个业务了。”
第三方 SERP 提供商——SerpApi(每月75-275美元)、ScaleSerp(约每月50美元)、Bright Data SERP API(企业版)——都是可行的选择,但每个都有自己独特的 JSON 模式。从 CSE 迁移到 SerpApi 需要重写你的解析层。迁移到 ScaleSerp 是另一种重写。迁移到 Bright Data 则是第三种重写。
`google-cse-replacement`(https://apify.com/nexgendata/google-cse-replacement?fpr=2ayu9b&utm_source=thenextgennexus&utm_medium=page&utm_campaign=google-cse-replacement)actor 采用了与 Dark Sky 替代品处理天气相同的方法:它在 SERP 抓取后端(Apify 的 GOOGLE_SERP 代理)之上发出完全相同的 CSE JSON 模式,因此如果你的代码解析 `searchInformation.totalResults`、`items[].title`、`items[].link` 和 `items[].snippet`,你只需修改两行代码即可继续运行。
*定价和速率限制数据截至2026年第三季度;在与每个供应商确认前请核实。*
## 为什么 CSE 很重要
多年来,Google CSE JSON API 最接近官方认可的“搜索互联网”API。v1 API 于2006年推出,v2 大约在2011年,而大多数当前集成使用的 JSON v1 变体自2015年开始。它服务于三个不同的受众群体:
- **“站点搜索”运营者。**你可以将 CSE 限定在特定网站集,并将其作为自己营销网站上的搜索栏。简单、便宜且具有 Google 的准确性。根据 Google 自己的汇总统计数据,约占 CSE 使用量的40%。
- **“为代理/机器人/助手进行的网络搜索”。**你有一个机器人、研究助手或 RAG 管道,需要在公共网络上查找信息。CSE 为任何查询返回 Google 前10个自然搜索结果,这是一个用于摘要或下游抓取的干净输入。约占使用量的35%。
- **“研究与学术工作”。**语料库构建者、媒体研究人员、研究信息检索的政治科学家、验证引用的律师事务所。该数据集不像 CommonCrawl 那样可以通过抓取重现,但 CSE 为你提供了一条稳定、可商业许可的路径,了解“Google 认为今天此查询的最佳结果是什么”。约占使用量的25%。
每个受众群体对替代品都有不同的需求,并且当 CSE 关闭时,每个群体都会以不同的方式受到影响。
## 当前 CSE JSON 格式
作为参考,CSE 响应如下所示:
```json
{
"kind": "customsearch#search",
"url": {
"type": "application/json",
"template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&..."
},
"queries": {
"request": [{
"title": "Google Custom Search - climate change",
"totalResults": "124000000",
"searchTerms": "climate change",
"count": 10,
"startIndex": 1,
"inputEncoding": "utf8",
"outputEncoding": "utf8",
"safe": "off",
"cx": "YOUR_CSE_ID"
}],
"nextPage": [{ "startIndex": 11, "count": 10 }]
},
"context": { "title": "My CSE" },
"searchInformation": {
"searchTime": 0.42,
"formattedSearchTime": "0.42",
"totalResults": "124000000",
"formattedTotalResults": "124,000,000"
},
"items": [
{
"kind": "customsearch#result",
"title": "Climate change - Wikipedia",
"htmlTitle": "Climate change - Wikipedia",
"link": "https://en.wikipedia.org/wiki/Climate_change",
"displayLink": "en.wikipedia.org",
"snippet": "Climate change includes both human-induced...",
"htmlSnippet": "Climate change includes both...",
"formattedUrl": "https://en.wikipedia.org/wiki/Climate_change",
"htmlFormattedUrl": "https://en.wikipedia.org/wiki/Climate_change",
"pagemap": { ... }
}
]
}
```
结构很多。替代品会返回其中的每一个字段。
## 新旧功能对比矩阵
功能Google CSE(将于2027年1月停止服务)Vertex AI SearchSerpApiScaleSerpBright Data SERP`google-cse-replacement`返回公共网络 Google 结果是是(仅限你的语料库存)是是是是JSON 模式匹配 CSE是是是(需要付费)是是是是站点范围搜索 (`siteSearch=`)是是(在你的语料库上)是是是是`q` 查询字符串是是是是是是分页 (`start=`, `num=`)最多100不适用最多100最多100最多300+最多100`lr`, `cr` 语言/国家筛选是部分是是是是图片搜索是是是是是是`sort` 参数是是不适用有限有限有限部分广告拦截检测包含无是(付费层级)是是是相关搜索仅通过 UI是是是是是知识图谱/知识面板是不适用是是是是企业 SLA是是是(付费)是有限定价对比:一个中等规模应用每月执行10万次搜索
提供商定价模式每月费用(10万次)说明Google CSE每1000次查询5美元(超过每天100次免费后)500美元2027年1月起停止服务Vertex AI Search基础层约每1000次2美元;扩展后最高7美元+200-700美元+不是 CSE 直接替代品;需要自有语料库SerpApi入门版75美元/月(5000次),开发者版275美元/月(25000次),生产版500美元/月(100000次)500美元包含知识面板、相关搜索ScaleSerp每查询0.00075-0.001美元层级75-100美元便宜但功能集较薄Bright Data SERP约每1000次5美元(月超100万次有折扣)500美元面向企业**`google-cse-replacement`****每查询0.005美元 PPE****500美元**兼容 CSE 模式;自带费率计划每月10万次时,替代品价格与 CSE 大致相当。在较低使用量下,PPE 意味着按使用量付费——每月1000次搜索的项目只需支付5美元,而不是75美元的底价。
## CSE 配额数学(比你想象的要奇怪)
理解现有的 CSE 配额结构很重要,因为迁移策略取决于它:
- **免费层**:每天100次查询。在太平洋时间午夜重置。
- **付费层**:每1000次查询5美元,每个 CSE 引擎 ID 每天最多10000次查询。
- **多个引擎 ID**:单个 Google 账户可以创建多个 CSE 引擎,每个引擎都有各自每天10000次的限制。拥有五个引擎的团队理论上可以每天达到50000次。
- **没有官方并发限制**,但持续超过每秒50次查询往往会触发不明确的限流。
当 CSE 关闭时,“使用多个引擎 ID 提高吞吐量”的技巧将对大多数人造成最大的伤害。多年来,重度用户一直通过合并3-5个引擎来突破每个引擎每天10000次的限制。这一容量将一次性消失。
替代品没有每个引擎的上限——按查询付费,actor 通过代理池管理并发。有效吞吐量大致为持续每秒100-200次查询,突发可达每秒500+次查询,具体取决于 Apify 层级的并发限制。
## 架构
```
[你的应用]
|
| (与 CSE 相同的 HTTP 调用方式)
v
[google-cse-replacement actor]
|
+-> 输入验证器
| - q, cx, key (忽略), num, start, lr, cr, safe, siteSearch, searchType
|
+-> Apify GOOGLE_SERP 代理
| - 轮换 IP 和会话
| - 处理 Google 的速率限制信号
| - 返回原始 SERP HTML
|
+-> SERP 解析器
| - 提取自然结果
| - 提取元数据 (totalResults, searchTime)
| - 尽可能提取 pagemap
|
+-> CSE 模式序列化器
| - 以精确的 CSE v1 JSON 格式发出响应
|
v
[形状与 CSE 一致的 JSON 响应]
```
GOOGLE_SERP 代理是 Apify 专用的 SERP 抓取基础设施。它处理 CAPTCHA 轮换、IP 声誉管理和 TLS 指纹识别——所有与大容量 Google 通信时棘手的部分。每次通过代理的调用都会产生固定成本,由每查询0.005美元的 PPE 吸收。
## 迁移:只需修改两行代码
现有的 CSE 代码如下所示:
```python
import requests
resp = requests.get("https://www.googleapis.com/customsearch/v1", params={
"key": GOOGLE_API_KEY,
"cx": CSE_ENGINE_ID,
"q": "climate change",
"num": 10,
})
data = resp.json()
for item in data["items"]:
print(item["title"], item["link"])
```
迁移后的版本:
```python
from apify_client import ApifyClient
client = ApifyClient("APIFY_TOKEN")
run = client.actor("nexgendata/google-cse-replacement").call(run_input={
"q": "climate change",
"num": 10,
})
data = client.dataset(run["defaultDatasetId"]).iterate_items().__next__()
for item in data["items"]:
print(item["title"], item["link"])
```
下游解析的字段(`items[].title`、`items[].link`、`items[].snippet`、`items[].displayLink`、`searchInformation.totalResults`)都以相同方式填充。
## 代码示例
### Python:RAG 管道迁移
一种常见模式:使用 CSE 查找相关 URL 供 LLM 进行摘要的 RAG 管道。
```python
from apify_client import ApifyClient
c
相似文章
Google将终止Tenor在其他应用中的GIF搜索
Google将于2026年6月30日关闭Tenor API,迫使X、Discord、WhatsApp等应用迁移到替代的GIF选择器。Tenor网站和Google自家的服务不受影响。
谷歌关闭Tenor GIF API,迫使X、Discord等平台做出改变
谷歌已于2026年6月30日停止提供Tenor GIF API,影响了依赖该API的X和Discord等平台。
做好准备:谷歌计划在2026年用代理式AI重塑搜索
谷歌计划在2026年用代理式AI彻底改造搜索,使用户能通过搜索查询生成自定义UI应用,例如旅行行程。该功能由Gemini 3.5驱动,代表了从蓝色链接到AI生成内容的转变,具有个性化、可共享迷你应用的潜力。
再见传统SEO:你的网站准备好迎接2026年AI的致命一击了吗?
谷歌即将在搜索中推出的'AI Mode'预计到2026年将彻底改变SEO,可能抹杀传统关键词策略,迫使营销人员专注于上下文答案、零点击结果和第一方数据。
Web搜索正在遭遇严重的性能瓶颈:谷歌关闭免费搜索索引,Cloudflare等流量防御者处处挑战AI。我们还有哪些选择?
谷歌即将终止其面向特定网站的免费搜索索引服务(限制在50个域名以内),而Cloudflare和Go-Daddy则开始阻止AI爬虫抓取网络数据,这可能会影响依赖互联网访问的本地AI模型。