google-trends-for-agent 0.2.44 → 0.2.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.45 — 2026-11-30
4
+
5
+ ### npm package metadata & migration guide links
6
+ - Point `package.json` `homepage` to `https://meka.im/google-trends-for-agent` so npm and downstream registries link directly to the official product page while `repository` stays on GitHub.
7
+ - Add a **Migration guides & resources** section to `README.md` and `README.zh-CN.md` linking to the interactive demo, the 59 open Google Ads calibration anchors dataset, and both `pytrends` migration & real daily search volume guides.
8
+
3
9
  ## 0.2.44 — 2026-11-26
4
10
 
5
11
  ### dsh UI polish, local-failure Actor CTA & 1-click settings
package/README.md CHANGED
@@ -6,113 +6,112 @@
6
6
  </picture>
7
7
  </p>
8
8
 
9
- <p align="center"><b>Search-interest signals for AI agents. One call in, stable JSON out.</b></p>
9
+ <p align="center"><b>Free, open-source (MIT) <code>pytrends</code> alternative for AI agents, CLI &amp; MCP — real daily search volume calibrated via 59 Google Ads anchors.</b></p>
10
10
 
11
- <p align="center">English | <a href="README.zh-CN.md">简体中文</a></p>
11
+ <p align="center">English | <a href="README.zh-CN.md">简体中文</a> | <a href="https://meka.im/google-trends-for-agent">Interactive Demo &amp; 59 Anchors</a> | <a href="https://x.com/hey_boyce">X (@hey_boyce)</a></p>
12
12
 
13
- <p align="center"><a href="https://www.npmjs.com/package/google-trends-for-agent"><img src="https://img.shields.io/npm/v/google-trends-for-agent?style=flat-square&logo=npm&logoColor=white&color=CB3837" alt="npm version"></a> <a href="https://apify.com/meka.im/google-trends-for-agent"><img src="https://img.shields.io/badge/Apify%20Store-google--trends--for--agent-97D700?style=flat-square" alt="Apify Store"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square&logo=node.js&logoColor=white" alt="Node.js >= 20"></a> <img src="https://img.shields.io/badge/TypeScript-strict-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript strict"> <img src="https://img.shields.io/badge/status-unofficial-orange?style=flat-square" alt="Unofficial"></p>
13
+ <p align="center"><a href="https://www.npmjs.com/package/google-trends-for-agent"><img src="https://img.shields.io/npm/v/google-trends-for-agent?style=flat-square&logo=npm&logoColor=white&color=CB3837" alt="npm version"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square&logo=node.js&logoColor=white" alt="Node.js >= 20"></a> <img src="https://img.shields.io/badge/TypeScript-strict-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript strict"> <a href="https://x.com/hey_boyce"><img src="https://img.shields.io/badge/X-@hey__boyce-000000?style=flat-square&logo=x&logoColor=white" alt="Follow @hey_boyce on X"></a> <a href="https://glama.ai/mcp/servers/meka-im/google-trends-for-agent"><img src="https://glama.ai/mcp/servers/meka-im/google-trends-for-agent/badges/score.svg" alt="Glama MCP Server" height="20"></a> <a href="https://apify.com/meka.im/google-trends-for-agent"><img src="https://img.shields.io/badge/Apify%20Store-google--trends--for--agent-97D700?style=flat-square" alt="Apify Store"></a> <img src="https://img.shields.io/badge/status-unofficial-orange?style=flat-square" alt="Unofficial"></p>
14
14
 
15
- <p align="center"><a href="https://apify.com/meka.im/google-trends-for-agent"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/store-button-en-dark.png"><img src="docs/assets/store-button-en.png" alt="Open in Apify Store" width="231" height="44"></picture></a></p>
16
-
17
- > [!WARNING]
18
- > **Unofficial. Not affiliated with or endorsed by Google.** This project calls undocumented public Google Trends web endpoints that can change or fail without notice, and use may conflict with Google's Terms of Service. Use it for light, interactive analysis, not bulk scraping or an SLA.
19
-
20
- `google-trends-for-agent` gives agents and humans a predictable way to ask how search interest is changing: a stable JSON envelope, calibrated searches/day estimates, charts, and explicit error codes instead of invented numbers.
15
+ `google-trends-for-agent` (`gtfa`) is a modern open-source (MIT) alternative to the archived [`pytrends`](https://github.com/GeneralMills/pytrends) library, built for AI agents, CLI workflows, and MCP clients. Instead of raw 0–100 relative curves or frequent HTTP 429 failures, it returns a stable JSON envelope, **calibrated daily search volume estimates** (using 59 public Google Ads anchors), charts, and explicit error codes.
21
16
 
22
17
  <p align="center">
23
18
  <img src="docs/assets/demo-terminal.svg" alt="Animated gtfa snapshot command revealing the trimmed JSON envelope for Sora" width="800">
24
19
  </p>
25
20
  <p align="center"><sub>Real snapshot output, trimmed. The full envelope also includes the series, primary and 7-day traffic blocks, related-query context, warnings, and metadata.</sub></p>
26
21
 
27
- ## Choose your client guide
28
-
29
- **AI agents: start at the [Client Setup Router](docs/clients.md) and open the guide for your exact host before installing or calling tools.**
30
-
31
- - [DeepSeek Harness (dsh)](docs/clients/dsh.md) · [GrokBot](docs/clients/grokbot.md) · [Muse](docs/clients/muse.md) · [Dots & Web Agents](docs/clients/dots.md)
32
- - [Claude Code & Desktop](docs/clients/claude.md) · [OpenAI Codex](docs/clients/codex.md) · [Cursor / VS Code / Windsurf / Cline](docs/clients/cursor-vscode.md) · [OpenClaw & CLI](docs/clients/openclaw.md)
33
-
34
- **Muse, GrokBot and Dots: use Apify on demand by default**, with either the public
35
- Actor or your own deployment. Use the managed remote MCP gateway where supported,
36
- or the client's authenticated Apify connector/API. Local access remains available
37
- for development and explicit direct-use setups.
38
-
39
- | Route | Where it runs | Execution |
40
- | --- | --- | --- |
41
- | Public Actor | Your Apify account | One run per query; exits when done, no deployment |
42
- | My own Actor | Your Apify account | Deploy once, then run on demand |
43
- | Local | This machine | CLI, stdio MCP, or native dsh tools |
22
+ > [!WARNING]
23
+ > **Unofficial. Not affiliated with or endorsed by Google.** This project calls undocumented public Google Trends web endpoints that can change or fail without notice, and use may conflict with Google's Terms of Service. Use it for light, interactive analysis, not bulk scraping or an SLA.
44
24
 
45
- <a id="deploy-it-yourself"></a>
25
+ ## Quick start (Node.js 20+)
46
26
 
47
- ### Deploy it yourself
27
+ Run immediately with `npx` on your own local IP (**`$0` unlimited** — also honors your own `HTTPS_PROXY` / `HTTP_PROXY` with zero quota cap):
48
28
 
49
- Fork the repository and build it with Link Git repository in Apify Console, or run `apify push`. Keep Server / Standby disabled. In dsh, select My own Actor, sign in with Apify, and select the built Actor.
29
+ ```sh
30
+ npx -y -p google-trends-for-agent gtfa snapshot Sora --geo US --json --pretty
31
+ ```
50
32
 
51
- For an existing deployment from official main, use **Update selected Actor** in dsh. After the build finishes, **Test connection** shows keyword access and the actual Actor/plugin versions separately. Custom or pinned source is updated in Apify Console. See the [release and acceptance checklist](docs/releasing.md).
33
+ Or install globally from npm ([`google-trends-for-agent`](https://www.npmjs.com/package/google-trends-for-agent)):
52
34
 
53
- ### Remote MCP
35
+ ```sh
36
+ npm install -g google-trends-for-agent
37
+ ```
54
38
 
55
- For Muse, GrokBot and Dots with remote MCP support, use Apify's hosted gateway
56
- and complete OAuth in the client:
39
+ Add the local MCP server (`gtfa-mcp`) to Claude Code, Cursor, Codex, or Windsurf:
57
40
 
58
41
  ```json
59
42
  {
60
43
  "mcpServers": {
61
44
  "google-trends": {
62
- "url": "https://mcp.apify.com?tools=meka.im/google-trends-for-agent"
45
+ "command": "npx",
46
+ "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp"]
63
47
  }
64
48
  }
65
49
  }
66
50
  ```
67
51
 
68
- For your own deployment, replace `meka.im/google-trends-for-agent` in `tools=`
69
- with your account's `<username>/<actor-name>`. The account must have access to it.
52
+ ### Commands & MCP tools at a glance
70
53
 
71
- The gateway exposes this project as an Actor tool and supplies Dataset, key-value-store, and abort tools. It starts a one-off run; it does not promise the four direct `trends_*` names. Local MCP and the native dsh plugin provide the four `trends_*` tools. For ordinary `tool` / `terms` Actor input, read the results using the returned Dataset id.
54
+ - **`gtfa snapshot <term>`** (`trends_snapshot`) — trend curve, **calibrated daily search volume**, and related queries in one call.
55
+ - **`gtfa ask <term>`** (`trends_ask`) — quick single-term momentum check with optional anchor validation (`--validate`).
56
+ - **`gtfa compare <a,b,...>`** (`trends_compare`) — compare up to 5 keywords side by side (`--calibrate` for daily searches).
57
+ - **`gtfa now`** (`trends_now`) — real-time trending searches across up to 30 countries.
72
58
 
73
- Apify's `full_api_access` OAuth scope grants account-wide API access. Clients without MCP OAuth can configure a Bearer header through their credential storage. See the [Actor reference](.actor/README.md) and [Actor costs](docs/reference.md#actor-costs).
59
+ ## Why `google-trends-for-agent`?
74
60
 
75
- ## Install & quick start
61
+ | Capability | `google-trends-for-agent` (MIT) | `pytrends` (Archived Apr 2025) | Legacy SEO Tools (Ahrefs / Semrush) |
62
+ | --- | --- | --- | --- |
63
+ | **Status & License** | Actively maintained · 100% Free MIT | Archived read-only (last push 2024) | Paid subscription ($99–$139+/mo) |
64
+ | **Breakout Keywords** | Real-time capture (e.g. `gemini 4 carbon` at `18,000/day`) | Relative `0–100` only | Shows `0` for 30+ days |
65
+ | **Daily Search Volume** | Calibrated via [59 open Google Ads anchors](https://meka.im/google-trends-for-agent#anchors) | No absolute volume | Lagging monthly averages |
66
+ | **HTTP 429 Recovery** | **`$0` unlimited** on Local IP or your own `HTTPS_PROXY` / `HTTP_PROXY` · or 1-click switch to **Public Open-Source Actor** (`$5/mo` Apify free tier ≈ 3,000–7,000 queries) or **Self-Hosted Actor** (same MIT repo) | Frequent `TooManyRequestsError (429)` | Closed database |
67
+ | **Surfaces** | CLI (`gtfa`), MCP (`gtfa-mcp`), DeepSeek Harness (`dsh`) plugin, Apify Actor | Python script only | Web UI / paid API |
76
68
 
77
- The CLI and MCP server are published on npm as [`google-trends-for-agent`](https://www.npmjs.com/package/google-trends-for-agent) and require Node.js 20+. Run immediately with `npx`:
69
+ ## Choose your client guide & egress route
78
70
 
79
- ```sh
80
- npx -y -p google-trends-for-agent gtfa snapshot Sora --geo US --json --pretty
81
- ```
71
+ **AI agents: start at the [Client Setup Router](docs/clients.md) and open the guide for your exact host before installing or calling tools.**
82
72
 
83
- For frequent use, install globally from npm:
73
+ - [DeepSeek Harness (dsh)](docs/clients/dsh.md) · [GrokBot](docs/clients/grokbot.md) · [Muse](docs/clients/muse.md) · [Dots & Web Agents](docs/clients/dots.md)
74
+ - [Claude Code & Desktop](docs/clients/claude.md) · [OpenAI Codex](docs/clients/codex.md) · [Cursor / VS Code / Windsurf / Cline](docs/clients/cursor-vscode.md) · [OpenClaw & CLI](docs/clients/openclaw.md)
84
75
 
85
- ```sh
86
- npm install -g google-trends-for-agent
87
- ```
76
+ | Route | Where it runs | Execution |
77
+ | --- | --- | --- |
78
+ | Local | This machine | Default **`$0` unlimited** direct access (also honors custom `HTTPS_PROXY` / `HTTP_PROXY`) via CLI, stdio MCP, or native dsh tools |
79
+ | Public Actor | Your Apify account | One run per query; exits when done, no deployment (`$5/mo` free tier) |
80
+ | My own Actor | Your Apify account | Deploy this MIT repo once, then run on demand |
88
81
 
89
- Or build from source if you prefer a local git checkout:
82
+ **Muse, GrokBot and Dots: use Apify on demand by default**, with either the public Actor or your own deployment. Use the managed remote MCP gateway where supported, or the client's authenticated Apify connector/API. Local access remains available for development and explicit direct-use setups.
90
83
 
91
- ```sh
92
- git clone https://github.com/meka-im/google-trends-for-agent.git
93
- cd google-trends-for-agent
94
- npm ci
95
- npm install -g "$(npm pack | tail -1)"
96
- ```
84
+ <p align="left"><a href="https://apify.com/meka.im/google-trends-for-agent"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/store-button-en-dark.png"><img src="docs/assets/store-button-en.png" alt="Open in Apify Store" width="231" height="44"></picture></a></p>
97
85
 
98
- The source checkout tracks the repository's default `main` branch. If your review process requires an immutable source revision, pin a published npm version or git commit rather than relying on a moving branch.
86
+ <a id="deploy-it-yourself"></a>
99
87
 
100
- The published tarball bundles the audited `apify` dependency tree so a consumer install does not re-resolve older vulnerable Apify transitives. Root npm `overrides` do not propagate into consumers, so this bundle is part of the consumer protection. The root also applies an explicit `@crawlee/core` → `minimatch` `^11.0.1` security override (lock: `11.0.8`); Crawlee declares `^9`, so consumer `npm ls` may show a range warning even though the explicit override is intentional. Audits cover both the root tree and a clean install of the packed artifact. Bundling materially increases package size.
88
+ ### Deploy it yourself
89
+
90
+ Fork the repository and build it with Link Git repository in Apify Console, or run `apify push`. Keep Server / Standby disabled. In dsh, select My own Actor, sign in with Apify, and select the built Actor.
91
+
92
+ For an existing deployment from official main, use **Update selected Actor** in dsh. After the build finishes, **Test connection** shows keyword access and the actual Actor/plugin versions separately. Custom or pinned source is updated in Apify Console. See the [release and acceptance checklist](docs/releasing.md).
93
+
94
+ ### Remote MCP & cloud egress options
101
95
 
102
- The CLI is `gtfa`; `gtfa-mcp` runs the local MCP server. Both default to `local` egress (this machine's network) and also support Apify on-demand cloud egress (`--egress actor-public` or `--egress actor-own --actor <id>`, or `GTFA_EGRESS` / `GTFA_APIFY_ACTOR` with `APIFY_TOKEN`), giving direct access to the four `trends_*` tools through Apify's residential proxy. For managed remote MCP without a local Node process, Muse, GrokBot and Dots should start with the [Apify setup](docs/clients.md):
96
+ For Muse, GrokBot and Dots with remote MCP support, use Apify's hosted gateway and complete OAuth in the client:
103
97
 
104
98
  ```json
105
99
  {
106
100
  "mcpServers": {
107
101
  "google-trends": {
108
- "command": "npx",
109
- "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp"]
102
+ "url": "https://mcp.apify.com?tools=meka.im/google-trends-for-agent"
110
103
  }
111
104
  }
112
105
  }
113
106
  ```
114
107
 
115
- To route local stdio MCP or CLI calls through Apify's public Actor with `APIFY_TOKEN` in the client's secure environment:
108
+ For your own deployment, replace `meka.im/google-trends-for-agent` in `tools=` with your account's `<username>/<actor-name>`. The account must have access to it.
109
+
110
+ The gateway exposes this project as an Actor tool and supplies Dataset, key-value-store, and abort tools. It starts a one-off run; it does not promise the four direct `trends_*` names. Local MCP and the native dsh plugin provide the four `trends_*` tools. For ordinary `tool` / `terms` Actor input, read the results using the returned Dataset id.
111
+
112
+ Apify's `full_api_access` OAuth scope grants account-wide API access. Clients without MCP OAuth can configure a Bearer header through their credential storage. See the [Actor reference](.actor/README.md) and [Actor costs](docs/reference.md#actor-costs).
113
+
114
+ The CLI is `gtfa`; `gtfa-mcp` runs the local MCP server. Both default to `local` egress (this machine's network) and also support Apify on-demand cloud egress (`--egress actor-public` or `--egress actor-own --actor <id>`, or `GTFA_EGRESS` / `GTFA_APIFY_ACTOR` with `APIFY_TOKEN`), giving direct access to the four `trends_*` tools through Apify's residential proxy:
116
115
 
117
116
  ```json
118
117
  {
@@ -140,6 +139,22 @@ For a local **Streamable HTTP** endpoint (bound to `127.0.0.1`):
140
139
  npx -y -p google-trends-for-agent gtfa-mcp --http --port 4321 # http://127.0.0.1:4321/mcp
141
140
  ```
142
141
 
142
+ <details>
143
+ <summary>Build from source, packaging audit notes &amp; connectivity diagnostics</summary>
144
+
145
+ Build from a local git checkout:
146
+
147
+ ```sh
148
+ git clone https://github.com/meka-im/google-trends-for-agent.git
149
+ cd google-trends-for-agent
150
+ npm ci
151
+ npm install -g "$(npm pack | tail -1)"
152
+ ```
153
+
154
+ The source checkout tracks the repository's default `main` branch. If your review process requires an immutable source revision, pin a published npm version or git commit rather than relying on a moving branch.
155
+
156
+ The published tarball bundles the audited `apify` dependency tree so a consumer install does not re-resolve older vulnerable Apify transitives. Root npm `overrides` do not propagate into consumers, so this bundle is part of the consumer protection. The root also applies an explicit `@crawlee/core` → `minimatch` `^11.0.1` security override (lock: `11.0.8`); Crawlee declares `^9`, so consumer `npm ls` may show a range warning even though the explicit override is intentional. Audits cover both the root tree and a clean install of the packed artifact. Bundling materially increases package size.
157
+
143
158
  Check both package-download and data-fetch connectivity:
144
159
 
145
160
  ```sh
@@ -149,6 +164,8 @@ curl -I https://trends.google.com
149
164
 
150
165
  If `npx …` exits non-zero with empty stdout/stderr, the npm package fetch failed before gtfa started; inspect the npm debug log (typically `~/.npm/_logs/`). **MCP fails to start** means npx/npm errors or EOF before the handshake. **MCP started but a tool fetch failed** means the handshake and `tools/list` succeed, but the tool returns `NETWORK_ERROR`, `RATE_LIMITED`, or another upstream error. Use `gtfa doctor --json` for the latter.
151
166
 
167
+ </details>
168
+
152
169
  ## dsh plugin
153
170
 
154
171
  <p align="center">
@@ -280,6 +297,34 @@ npm run build
280
297
  npm run trends -- --help
281
298
  ```
282
299
 
300
+ ## Migration guides & resources
301
+
302
+ - [Interactive Demo & Docs](https://meka.im/google-trends-for-agent) — live walkthrough, client setup tabs, and egress comparison.
303
+ - [59 Open Google Ads Calibration Anchors (JSON)](https://meka.im/datasets/google-trends-anchors) — auditable daily search volume baselines across 7 regions.
304
+ - [How to Fix `pytrends` HTTP 429 & Broken Endpoints (2026)](https://meka.im/blog/fix-pytrends-429-too-many-requests-broken-endpoints) — root-cause breakdown, 2026 alternatives comparison, and step-by-step migration.
305
+ - [How to Get Real Daily Search Volume from Google Trends (Not 0–100)](https://meka.im/blog/get-real-daily-search-volume-from-google-trends) — anchor calibration math, SEO rising-query workflows, and `pandas` CSV export.
306
+ - [MEKA Platform](https://meka.im) — structured web data APIs, tools, and datasets for AI agents.
307
+
308
+ ## Star History
309
+
310
+ <a href="https://www.star-history.com/#meka-im/google-trends-for-agent&Date">
311
+ <picture>
312
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=meka-im/google-trends-for-agent&type=Date&theme=dark" />
313
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=meka-im/google-trends-for-agent&type=Date" />
314
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=meka-im/google-trends-for-agent&type=Date" />
315
+ </picture>
316
+ </a>
317
+
283
318
  ## License
284
319
 
285
320
  MIT. See [LICENSE](LICENSE).
321
+
322
+ <p align="center">
323
+ <a href="https://meka.im/brand">
324
+ <picture>
325
+ <source media="(prefers-color-scheme: dark)" srcset="https://meka.im/brand/meka-lockup-dark.svg?v=c3c">
326
+ <source media="(prefers-color-scheme: light)" srcset="https://meka.im/brand/meka-lockup-light.svg?v=c3c">
327
+ <img src="https://meka.im/brand/meka-lockup-light.svg?v=c3c" alt="MEKA brand guidelines" width="128">
328
+ </picture>
329
+ </a>
330
+ </p>
package/README.zh-CN.md CHANGED
@@ -6,111 +6,112 @@
6
6
  </picture>
7
7
  </p>
8
8
 
9
- <p align="center"><b>面向 AI Agent 的搜索兴趣信号。一次调用,输出稳定 JSON。</b></p>
9
+ <p align="center"><b>免费开源 (MIT) 的现代 <code>pytrends</code> 替代方案(CLI / MCP / 桌面插件)— 基于 59 个 Google Ads 锚点校准真实日搜索量。</b></p>
10
10
 
11
- <p align="center"><a href="README.md">English</a> | 简体中文</p>
11
+ <p align="center"><a href="README.md">English</a> | 简体中文 | <a href="https://meka.im/google-trends-for-agent">在线演示与 59 个开源锚点</a> | <a href="https://x.com/hey_boyce">X (@hey_boyce)</a></p>
12
12
 
13
- <p align="center"><a href="https://www.npmjs.com/package/google-trends-for-agent"><img src="https://img.shields.io/npm/v/google-trends-for-agent?style=flat-square&logo=npm&logoColor=white&color=CB3837" alt="npm version"></a> <a href="https://apify.com/meka.im/google-trends-for-agent"><img src="https://img.shields.io/badge/Apify%20Store-google--trends--for--agent-97D700?style=flat-square" alt="Apify Store"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square&logo=node.js&logoColor=white" alt="Node.js >= 20"></a> <img src="https://img.shields.io/badge/TypeScript-strict-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript strict"> <img src="https://img.shields.io/badge/status-unofficial-orange?style=flat-square" alt="Unofficial"></p>
13
+ <p align="center"><a href="https://www.npmjs.com/package/google-trends-for-agent"><img src="https://img.shields.io/npm/v/google-trends-for-agent?style=flat-square&logo=npm&logoColor=white&color=CB3837" alt="npm version"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square&logo=node.js&logoColor=white" alt="Node.js >= 20"></a> <img src="https://img.shields.io/badge/TypeScript-strict-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript strict"> <a href="https://x.com/hey_boyce"><img src="https://img.shields.io/badge/X-@hey__boyce-000000?style=flat-square&logo=x&logoColor=white" alt="关注作者 X @hey_boyce"></a> <a href="https://apify.com/meka.im/google-trends-for-agent"><img src="https://img.shields.io/badge/Apify%20Store-google--trends--for--agent-97D700?style=flat-square" alt="Apify Store"></a> <img src="https://img.shields.io/badge/status-unofficial-orange?style=flat-square" alt="Unofficial"></p>
14
14
 
15
- <p align="center"><a href="https://apify.com/meka.im/google-trends-for-agent"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/store-button-zh-dark.png"><img src="docs/assets/store-button-zh.png" alt="在 Apify Store 打开" width="224" height="44"></picture></a></p>
16
-
17
- > [!WARNING]
18
- > **非官方项目,与 Google 无隶属关系,也未获其背书。** 本项目调用未公开的 Google Trends Web 接口,这些接口可能随时变更或失效,使用方式也可能与 Google 服务条款冲突。请仅用于轻量、交互式分析,不要用于批量抓取,也不要将其视为 SLA。
19
-
20
- `google-trends-for-agent` 让 Agent 和人类以可预测的方式查询搜索兴趣变化:稳定的 JSON 信封、校准后的每日搜索量估算、图表,以及明确的错误码,而不是编造数字。
15
+ `google-trends-for-agent`(`gtfa`)是已归档项目 [`pytrends`](https://github.com/GeneralMills/pytrends) 的现代免费开源(MIT)替代方案,专为 AI Agent、命令行和 MCP 客户端设计。它不只是抓取 0–100 相对指数,而是输出稳定的 JSON 信封、**基于 59 个公开 Google Ads 锚点校准的真实日搜索量估算**、趋势图与明确错误码。
21
16
 
22
17
  <p align="center">
23
18
  <img src="docs/assets/demo-terminal.svg" alt="动画演示 gtfa snapshot 命令逐字显示,并逐行返回 Sora 的裁剪 JSON 信封" width="800">
24
19
  </p>
25
20
  <p align="center"><sub>真实快照输出,已裁剪。完整信封还包含序列、主窗口与近 7 天流量块、相关查询上下文、警告和元数据。</sub></p>
26
21
 
27
- ## 按客户端选择安装教程
28
-
29
- **AI Agent 请先打开[客户端接入总入口](docs/clients.md),按自身所在宿主直接跳转到对应教程后再配置或调用。**
30
-
31
- - [DeepSeek Harness (dsh)](docs/clients/dsh.md) · [GrokBot](docs/clients/grokbot.md) · [Muse](docs/clients/muse.md) · [Dots 与网页 Agent](docs/clients/dots.md)
32
- - [Claude Code 与 Desktop](docs/clients/claude.md) · [OpenAI Codex](docs/clients/codex.md) · [Cursor / VS Code / Windsurf / Cline](docs/clients/cursor-vscode.md) · [OpenClaw 与本地 CLI](docs/clients/openclaw.md)
33
-
34
- **Muse、GrokBot、Dots 统一优先使用 Apify 按需运行**,可选公共 Actor 或自己部署的
35
- Actor。支持远程 MCP 时接入官方托管入口;否则使用客户端已有的 Apify 连接器/API。
36
- 本机直连继续用于开发或用户明确选择的场景。
37
-
38
- | 路线 | 执行位置 | 运行方式 |
39
- | --- | --- | --- |
40
- | 公共 Actor | 你的 Apify 账号 | 有查询才启动,完成即退出,无需部署 |
41
- | 自己的 Actor | 你的 Apify 账号 | 部署一次,随后按次运行 |
42
- | 本机直连 | 本机 | CLI、stdio MCP 或 dsh 原生工具 |
22
+ > [!WARNING]
23
+ > **非官方项目,与 Google 无隶属关系,也未获其背书。** 本项目调用未公开的 Google Trends Web 接口,这些接口可能随时变更或失效,使用方式也可能与 Google 服务条款冲突。请仅用于轻量、交互式分析,不要用于批量抓取,也不要将其视为 SLA。
43
24
 
44
- <a id="deploy-it-yourself"></a>
25
+ ## 快速开始(Node.js 20+)
45
26
 
46
- ### 自行部署
27
+ 直接用本机 IP 一行命令免费运行(**`$0` 不限次数**,无需注册账号,同时原生支持自接 `HTTPS_PROXY` / `HTTP_PROXY` 代理):
47
28
 
48
- Fork 仓库,在 Apify Console 用 Link Git repository 构建,或运行 `apify push`。保持 Server / Standby 关闭。dsh 中选择“我自己的 Actor”,登录 Apify,再选择已构建的 Actor。
29
+ ```sh
30
+ npx -y -p google-trends-for-agent gtfa snapshot Sora --geo US --json --pretty
31
+ ```
49
32
 
50
- 已从官方 main 部署的 Actor,可在 dsh 点击**更新选中的 Actor**。构建完成后,**测试连接**分别显示关键词取数与 Actor/插件的实际版本。自定义或固定版本源码请在 Apify Console 更新。详见[发布与验收清单](docs/releasing.md)。
33
+ 或从 npm 全局安装([`google-trends-for-agent`](https://www.npmjs.com/package/google-trends-for-agent)):
51
34
 
52
- ### 远程 MCP
35
+ ```sh
36
+ npm install -g google-trends-for-agent
37
+ ```
53
38
 
54
- Muse、GrokBot、Dots 支持远程 MCP 时,使用 Apify 官方托管入口,在客户端内完成 OAuth 登录:
39
+ 接入 Claude Code、Cursor、Codex 或 Windsurf 的本地 MCP(`gtfa-mcp`):
55
40
 
56
41
  ```json
57
42
  {
58
43
  "mcpServers": {
59
44
  "google-trends": {
60
- "url": "https://mcp.apify.com?tools=meka.im/google-trends-for-agent"
45
+ "command": "npx",
46
+ "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp"]
61
47
  }
62
48
  }
63
49
  }
64
50
  ```
65
51
 
66
- 使用自建 Actor 时,把 `tools=` 后的 `meka.im/google-trends-for-agent` 替换为自己账号的
67
- `<username>/<actor-name>`;登录账号需要有该 Actor 的访问权限。
52
+ ### 核心命令与 MCP 工具一览
68
53
 
69
- 该入口将本项目暴露为 Actor 工具,按次启动运行,并提供读取 Dataset、读取 key-value store 和停止运行的工具。它不承诺四个 `trends_*` 同名工具;本机 MCP 和 dsh 原生插件提供四个 `trends_*` 工具。通过官方入口调用普通 `tool` / `terms` 输入后,用返回的 Dataset id 读取结果。
54
+ - **`gtfa snapshot <term>`**(`trends_snapshot`)— 一次调用获取趋势曲线、**校准后日搜索量估算**与相关飙升词。
55
+ - **`gtfa ask <term>`**(`trends_ask`)— 快速查询单关键词势头,支持 `--validate` 锚点校验。
56
+ - **`gtfa compare <a,b,...>`**(`trends_compare`)— 最多 5 个关键词同屏对比(加 `--calibrate` 输出日搜索量)。
57
+ - **`gtfa now`**(`trends_now`)— 实时热搜榜单,最多覆盖 30 个国家/地区。
70
58
 
71
- Apify OAuth 的 `full_api_access` 是完整账号 API 权限。没有 MCP OAuth 的客户端可通过安全凭据配置 Bearer header。费用与边界见 [Actor 参考](.actor/README.md) 和 [Actor costs](docs/reference.md#actor-costs)。
59
+ ## 为什么选择 `google-trends-for-agent`?
72
60
 
73
- ## 安装与快速开始
61
+ | 能力对比 | `google-trends-for-agent` (MIT) | `pytrends`(2025 年 4 月已归档) | 传统 SEO 工具(Ahrefs / Semrush) |
62
+ | --- | --- | --- | --- |
63
+ | **维护与协议** | 持续维护 · 100% 免费 MIT 开源 | 已只读归档停更 | 付费订阅($99–$139+/月) |
64
+ | **刚爆发新词** | 实时捕获(如 `gemini 4 carbon` 峰值 `18,000 次/天`) | 仅 0–100 相对曲线 | 延迟 30+ 天显示 `0` |
65
+ | **真实日搜索量** | 基于 [59 个开源 Google Ads 锚点](https://meka.im/google-trends-for-agent#anchors) 实时校准 | 无绝对搜索量 | 月均滞后词库 |
66
+ | **HTTP 429 应对** | **本机 IP / 自接代理(`HTTPS_PROXY`)`$0` 无限次** · 也可 1 键切 **开源公共 Actor**(Apify 每月 `$5` 免费额度约跑 3,000–7,000 次)或 **自部署私有 Actor**(同源 MIT 代码) | 频繁报 `TooManyRequestsError (429)` | 闭源数据库 |
67
+ | **使用形态** | CLI(`gtfa`)、MCP(`gtfa-mcp`)、DeepSeek Harness(`dsh`)插件、Apify Actor | 仅 Python 脚本 | 网页端 / 付费 API |
74
68
 
75
- CLI 与 MCP 服务器已发布至 npm(包名 [`google-trends-for-agent`](https://www.npmjs.com/package/google-trends-for-agent)),需要 Node.js 20+。可直接通过 `npx` 运行:
69
+ ## 按客户端选择安装教程与抓取路线
76
70
 
77
- ```sh
78
- npx -y -p google-trends-for-agent gtfa snapshot Sora --geo US --json --pretty
79
- ```
71
+ **AI Agent 请先打开[客户端接入总入口](docs/clients.md),按自身所在宿主直接跳转到对应教程后再配置或调用。**
80
72
 
81
- 频繁使用建议直接从 npm 全局安装:
73
+ - [DeepSeek Harness (dsh)](docs/clients/dsh.md) · [GrokBot](docs/clients/grokbot.md) · [Muse](docs/clients/muse.md) · [Dots 与网页 Agent](docs/clients/dots.md)
74
+ - [Claude Code 与 Desktop](docs/clients/claude.md) · [OpenAI Codex](docs/clients/codex.md) · [Cursor / VS Code / Windsurf / Cline](docs/clients/cursor-vscode.md) · [OpenClaw 与本地 CLI](docs/clients/openclaw.md)
82
75
 
83
- ```sh
84
- npm install -g google-trends-for-agent
85
- ```
76
+ | 路线 | 执行位置 | 运行方式 |
77
+ | --- | --- | --- |
78
+ | 本机直连 | 本机 | 默认 **`$0` 无限次**免费直连(原生支持自接 `HTTPS_PROXY` / `HTTP_PROXY` 代理),支持 CLI、stdio MCP 或 dsh 原生工具 |
79
+ | 公共 Actor | 你的 Apify 账号 | 有查询才启动,完成即退出,无需部署(可用每月 `$5` 免费额度) |
80
+ | 自己的 Actor | 你的 Apify 账号 | 部署一次本 MIT 开源仓库,随后按次运行 |
86
81
 
87
- 也可以从源码仓库自行构建安装:
82
+ **Muse、GrokBot、Dots 统一优先使用 Apify 按需运行**,可选公共 Actor 或自己部署的 Actor。支持远程 MCP 时接入官方托管入口;否则使用客户端已有的 Apify 连接器/API。本机直连继续用于开发或用户明确选择的场景。
88
83
 
89
- ```sh
90
- git clone https://github.com/meka-im/google-trends-for-agent.git
91
- cd google-trends-for-agent
92
- npm ci
93
- npm install -g "$(npm pack | tail -1)"
94
- ```
84
+ <p align="left"><a href="https://apify.com/meka.im/google-trends-for-agent"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/store-button-zh-dark.png"><img src="docs/assets/store-button-zh.png" alt="在 Apify Store 打开" width="224" height="44"></picture></a></p>
95
85
 
96
- 源码 clone 默认跟随仓库的 `main` 分支。如果审查流程需要不可变源码版本,请固定 npm 版本号或 git commit,不要依赖移动的分支。
86
+ <a id="deploy-it-yourself"></a>
97
87
 
98
- 发布的 tarball 会内置经审计的 `apify` 依赖树,避免 consumer 重新解析较旧的 Apify 漏洞传递依赖。根 npm `overrides` 不会传播给 consumer,因此内置依赖树是 consumer 防护的一部分。根包还显式将 `@crawlee/core` 的 `minimatch` 覆盖为 `^11.0.1`(lock 为 `11.0.8`);Crawlee 声明的是 `^9`,因此 consumer 的 `npm ls` 可能显示范围警告,但这是有意设置的安全 override。审计同时覆盖根依赖树和打包产物在干净 consumer 中的安装;内置依赖会使包体积明显增大。
88
+ ### 自行部署
99
89
 
100
- CLI 命令是 `gtfa`,本地 MCP 服务器由 `gtfa-mcp` 启动。两者默认走 `local` 本机网络,也支持 Apify 按需云端出口(`--egress actor-public` 或 `--egress actor-own --actor <id>`,或通过环境变量 `GTFA_EGRESS` / `GTFA_APIFY_ACTOR` 配合 `APIFY_TOKEN`),可在直接暴露四个 `trends_*` 工具的同时走 Apify 住宅代理。若客户端支持免本地进程的远程托管 MCP,Muse、GrokBot、Dots 优先按[Apify 接入指南](docs/clients.md)配置:
90
+ Fork 仓库,在 Apify Console 用 Link Git repository 构建,或运行 `apify push`。保持 Server / Standby 关闭。dsh 中选择“我自己的 Actor”,登录 Apify,再选择已构建的 Actor。
91
+
92
+ 已从官方 main 部署的 Actor,可在 dsh 点击**更新选中的 Actor**。构建完成后,**测试连接**分别显示关键词取数与 Actor/插件的实际版本。自定义或固定版本源码请在 Apify Console 更新。详见[发布与验收清单](docs/releasing.md)。
93
+
94
+ ### 远程 MCP 与云端出口配置
95
+
96
+ Muse、GrokBot、Dots 支持远程 MCP 时,使用 Apify 官方托管入口,在客户端内完成 OAuth 登录:
101
97
 
102
98
  ```json
103
99
  {
104
100
  "mcpServers": {
105
101
  "google-trends": {
106
- "command": "npx",
107
- "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp"]
102
+ "url": "https://mcp.apify.com?tools=meka.im/google-trends-for-agent"
108
103
  }
109
104
  }
110
105
  }
111
106
  ```
112
107
 
113
- 需要本地 stdio MCP 直接走 Apify 公共 Actor 时(将 `APIFY_TOKEN` 放在客户端安全环境变量中):
108
+ 使用自建 Actor 时,把 `tools=` 后的 `meka.im/google-trends-for-agent` 替换为自己账号的 `<username>/<actor-name>`;登录账号需要有该 Actor 的访问权限。
109
+
110
+ 该入口将本项目暴露为 Actor 工具,按次启动运行,并提供读取 Dataset、读取 key-value store 和停止运行的工具。它不承诺四个 `trends_*` 同名工具;本机 MCP 和 dsh 原生插件提供四个 `trends_*` 工具。通过官方入口调用普通 `tool` / `terms` 输入后,用返回的 Dataset id 读取结果。
111
+
112
+ Apify OAuth 的 `full_api_access` 是完整账号 API 权限。没有 MCP OAuth 的客户端可通过安全凭据配置 Bearer header。费用与边界见 [Actor 参考](.actor/README.md) 和 [Actor costs](docs/reference.md#actor-costs)。
113
+
114
+ CLI 命令是 `gtfa`,本地 MCP 服务器由 `gtfa-mcp` 启动。两者默认走 `local` 本机网络,也支持 Apify 按需云端出口(`--egress actor-public` 或 `--egress actor-own --actor <id>`,或通过环境变量 `GTFA_EGRESS` / `GTFA_APIFY_ACTOR` 配合 `APIFY_TOKEN`),可在直接暴露四个 `trends_*` 工具的同时走 Apify 住宅代理:
114
115
 
115
116
  ```json
116
117
  {
@@ -138,6 +139,22 @@ CLI 命令是 `gtfa`,本地 MCP 服务器由 `gtfa-mcp` 启动。两者默认
138
139
  npx -y -p google-trends-for-agent gtfa-mcp --http --port 4321 # http://127.0.0.1:4321/mcp
139
140
  ```
140
141
 
142
+ <details>
143
+ <summary>从源码构建、依赖审计说明与连通性排查</summary>
144
+
145
+ 从源码仓库自行构建安装:
146
+
147
+ ```sh
148
+ git clone https://github.com/meka-im/google-trends-for-agent.git
149
+ cd google-trends-for-agent
150
+ npm ci
151
+ npm install -g "$(npm pack | tail -1)"
152
+ ```
153
+
154
+ 源码 clone 默认跟随仓库的 `main` 分支。如果审查流程需要不可变源码版本,请固定 npm 版本号或 git commit,不要依赖移动的分支。
155
+
156
+ 发布的 tarball 会内置经审计的 `apify` 依赖树,避免 consumer 重新解析较旧的 Apify 漏洞传递依赖。根 npm `overrides` 不会传播给 consumer,因此内置依赖树是 consumer 防护的一部分。根包还显式将 `@crawlee/core` 的 `minimatch` 覆盖为 `^11.0.1`(lock 为 `11.0.8`);Crawlee 声明的是 `^9`,因此 consumer 的 `npm ls` 可能显示范围警告,但这是有意设置的安全 override。审计同时覆盖根依赖树和打包产物在干净 consumer 中的安装;内置依赖会使包体积明显增大。
157
+
141
158
  检查包下载和数据抓取两段连通性:
142
159
 
143
160
  ```sh
@@ -147,6 +164,8 @@ curl -I https://trends.google.com
147
164
 
148
165
  若 `npx …` 非零退出且 stdout/stderr 为空,说明 gtfa 启动前 npm 包获取失败;查看 npm debug 日志(通常在 `~/.npm/_logs/`)。**MCP 无法启动**表现为 npx/npm 错误、握手前 EOF;**MCP 已启动但工具取数失败**则握手和 `tools/list` 成功,工具返回 `NETWORK_ERROR`、`RATE_LIMITED` 等上游错误。后者可用 `gtfa doctor --json` 排查。
149
166
 
167
+ </details>
168
+
150
169
  ## dsh 插件
151
170
 
152
171
  <p align="center">
@@ -277,6 +296,34 @@ npm run build
277
296
  npm run trends -- --help
278
297
  ```
279
298
 
299
+ ## 迁移指南与相关资源
300
+
301
+ - [产品交互页与文档](https://meka.im/google-trends-for-agent) — 视频演示、客户端接入配置与代理路线对比。
302
+ - [59 个公开 Google Ads 校准锚点数据集(JSON)](https://meka.im/datasets/google-trends-anchors) — 覆盖 7 个地区的公开可审计日搜索量基准。
303
+ - [pytrends 首请求 429 与 404 接口排障及 2026 替代方案](https://meka.im/blog/zh/fix-pytrends-429-too-many-requests-broken-endpoints) — 根因分析、4 条替代路线横评与旧脚本逐行迁移。
304
+ - [从 Google Trends 获取真实日搜索量(非 0–100)](https://meka.im/blog/zh/get-real-daily-search-volume-from-google-trends) — 59 个锚点校准原理、SEO 飙升词挖掘与 `pandas` 导出实战。
305
+ - [MEKA 官网](https://meka.im) — 面向 AI Agent 与开发者的结构化公开数据 API 与工具。
306
+
307
+ ## Star History
308
+
309
+ <a href="https://www.star-history.com/#meka-im/google-trends-for-agent&Date">
310
+ <picture>
311
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=meka-im/google-trends-for-agent&type=Date&theme=dark" />
312
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=meka-im/google-trends-for-agent&type=Date" />
313
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=meka-im/google-trends-for-agent&type=Date" />
314
+ </picture>
315
+ </a>
316
+
280
317
  ## 许可证
281
318
 
282
319
  MIT。见 [LICENSE](LICENSE)。
320
+
321
+ <p align="center">
322
+ <a href="https://meka.im/brand">
323
+ <picture>
324
+ <source media="(prefers-color-scheme: dark)" srcset="https://meka.im/brand/meka-lockup-dark.svg?v=c3c">
325
+ <source media="(prefers-color-scheme: light)" srcset="https://meka.im/brand/meka-lockup-light.svg?v=c3c">
326
+ <img src="https://meka.im/brand/meka-lockup-light.svg?v=c3c" alt="MEKA 品牌规范" width="128">
327
+ </picture>
328
+ </a>
329
+ </p>
@@ -2248,7 +2248,7 @@ function parseVersionStatus(value) {
2248
2248
 
2249
2249
  // src/client/update-banner.tsx
2250
2250
  var import_jsx_runtime5 = require("react/jsx-runtime");
2251
- var CLIENT_VERSION = "0.2.44" ? "0.2.44" : null;
2251
+ var CLIENT_VERSION = "0.2.45" ? "0.2.45" : null;
2252
2252
  var VERSION_URL = "api/gtfa.version";
2253
2253
  var DISMISS_STORAGE_KEY = "gtfa.update.dismissed.1";
2254
2254
  function template2(text2, values) {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "google-trends-for-agent",
3
- "version": "0.2.44",
3
+ "version": "0.2.45",
4
4
  "description": "Search-interest signals for AI agents — an unofficial Google Trends client",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -129,7 +129,7 @@
129
129
  "type": "git",
130
130
  "url": "git+https://github.com/meka-im/google-trends-for-agent.git"
131
131
  },
132
- "homepage": "https://github.com/meka-im/google-trends-for-agent",
132
+ "homepage": "https://meka.im/google-trends-for-agent",
133
133
  "bugs": {
134
134
  "url": "https://github.com/meka-im/google-trends-for-agent/issues"
135
135
  },