Google Trends Scraper

io.github.RalfIJ由 GitHub 账号 RalfIJ 发布v1.0.0更新于 Oct 24, 2026

Google Trends for any number of keywords on one scale: interest over time, regions, rising queries.

已验证Streamable HTTP可网页运行网页搜索与抓取数据与分析

概览

AI 生成的概览

一个托管在 Apify 上的 MCP 服务器,用于获取关键词的 Google Trends 数据,包括随时间变化的关注度、地区热度和相关查询。

可以做什么
获取一个或多个关键词在同一尺度下的 Google Trends 数据,包括关注度随时间变化和按地区分布,未完成的最后时段会标记为部分数据。获取热门和相关上升查询,包括突破性查询。获得计算指标,如平均、最新和峰值关注度、峰值日期、趋势方向与变化百分比、最繁忙月份,以及比较关键词时的搜索份额。通过将每五个关键词一组、以各组领先词串联并重新缩放,比较超过 Google 自身限制的关键词数量。
适用场景
适合需要让助手查询搜索热度趋势、在同一尺度上比较多个关键词,或获取地区与相关查询数据,同时不想自己编写抓取代码或处理 Google 的速率限制和会话 Cookie 的场景。
运行要求
远程 MCP 端点 mcp.apify.com,添加时需带上该抓取工具的 tools 参数。需要 Apify 账户,并通过 OAuth 登录或在 Authorization 请求头中提供 Apify API 令牌。需要能访问 Apify 的网络。
安装前请注意
运行费用计入你自己的 Apify 账户,按关键词计费,超出每月免费额度后会产生费用。Authorization 请求头携带 Apify API 令牌,必须保密。数据来自第三方抓取工具而非 Google,作者声明该抓取工具由其本人开发。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Google Trends Scraper,将其添加到工作区。
  2. 连接 所需的 凭据。它们会被私密存储,绝不会在公开页面上展示。
  3. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.RalfIJ%2Fgoogle-trends/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。 客户端会在首次连接时完成 OAuth 登录。

{
  "mcpServers": {
    "google-trends-scraper": {
      "type": "http",
      "url": "https://mcp.apify.com/?tools=ralfij/google-trends-scraper"
    }
  }
}

README

Google Trends API for Python (a pytrends alternative)

Get Google Trends data into Python: interest over time, interest by region, top and rising related searches, and simple trend metrics. You can also compare 10, 50 or 100+ keywords on one scale. The Google Trends website stops at 8 (5 in classic Explore).

pytrends was archived in April 2025 and often fails with 429 Too Many Requests. Google announced an official Trends API in July 2025, but it is an alpha with limited, application-based access. These examples use a hosted scraper instead, the Google Trends Scraper on Apify, which deals with Google's session cookies and rate limits for you.

Tutorial: Google Trends in Python without pytrends, and how to compare more keywords than Google allows. It covers the two endpoints behind the website, the trick for linking comparisons, and what the data looks like.

[Google searches for programming languages over 5 years]

Example output: search interest in the Programming category fell 40-68% for most languages between 2021 and 2026. Made with examples/compare_keywords.py and matplotlib.

Quick start

  1. Create a free Apify account. The free plan includes $5 of credit every month, which covers about 2,500 keywords. No credit card needed.
  2. Copy your API token from Settings > API & Integrations in Apify Console.
  3. Run an example:
bash
pip install -r requirements.txtexport APIFY_TOKEN=your-token        # Windows: set APIFY_TOKEN=your-tokenpython examples/compare_keywords.py
keyword       share %  average  trendjava             29.4     63.7  falling (-48.8%)c++              23.8     51.6  stable (-7.1%)python           15.8     34.3  falling (-43.7%)...

Examples

FileWhat it does
examples/compare_keywords.pyCompares 10 keywords on one shared scale, prints share of search and trend, and saves a CSV
examples/keyword_report.pyTrend, peak, busiest month, top regions and rising searches per keyword
examples/plot_trends.pyPlots interest over time for several keywords with matplotlib
examples/raw_endpoints.pyThe two JSON endpoints behind trends.google.com, with no library at all. Good for a few keywords.

sample-output/programming-languages-5y.csv shows the CSV from compare_keywords.py.

What you get per keyword

  • interestOverTime: the full time series (0-100), with the unfinished last week or day marked partial
  • interestByRegion: countries, states or regions where the keyword is most popular
  • relatedQueriesTop and relatedQueriesRising, including breakouts
  • averageInterest, latestInterest, peakInterest, peakDate
  • trend (rising, falling or stable) and trendChangePercent: the last quarter of the period against the first quarter
  • busiestMonth for periods of about a year or longer
  • shareOfSearch when you compare keywords on one shared scale

How comparing many keywords works

Google's Trends API compares at most 5 keywords per request (the website shows up to 8) and scales each request so its highest point is 100. To compare more, the scraper:

  1. requests the keywords in groups of 5;
  2. compares the most searched keyword of each group (the group "leader") with the other leaders, 5 at a time with one leader of overlap, so any number of groups can be chained;
  3. rescales every group through its leader, then rescales everything so the highest point overall is 100.

Google rounds to whole numbers, so a tiny keyword next to a huge one can still show as 0. Compare keywords of a similar size for the best precision.

Use it from AI assistants (MCP)

To let Claude, Cursor, VS Code or another MCP client look up Google Trends for you, add this MCP server URL: https://mcp.apify.com/?tools=ralfij/google-trends-scraper. Sign in to Apify when the client asks, or send your Apify API token as Authorization: Bearer <token>. Runs are billed to your own Apify account.

Notes

  • I built the Google Trends Scraper used in these examples, so keep that in mind. raw_endpoints.py shows how to do it yourself.
  • Pricing is per keyword with no subscription; see the actor page. More ready-made searches are on its example tasks.
  • Not affiliated with, endorsed by or sponsored by Google. Google Trends is a trademark of Google LLC.

License

MIT

来源:README.md,提交 b5380a2

工具

0
该服务器需要登录,因此 SourceWeft 无法在没有账号的情况下读取其工具,也未收录。已连接账号所能看到的内容可能因账号及其权限而异。

版本历史

1
  1. v1.0.0最新Oct 10, 2026

评分

已满足适用检查项的 85%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分