This commit is contained in:
a2a-platform
2026-06-12 18:12:21 +00:00
commit 2684a2fdbc
7 changed files with 1136 additions and 0 deletions

51
README.md Normal file
View File

@@ -0,0 +1,51 @@
# google-trends-agent
Google Trends fetcher that uses SeleniumBase UC/CDP mode with Playwright.
The A2A entrypoint exposes one skill, `fetch`, with:
- `task`: a Google Trends URL or plain query string
- `date`: optional Trends date window, default `now 1-d`
- `geo`: optional geo code, default `BR`
Default task:
```text
https://trends.google.com/trends/explore?q=copa%20do%20mundo%20da%20fifa%202026&date=now%201-d&geo=BR
```
## Install
```bash
python -m pip install -r requirements.txt
playwright install chromium
```
## Run Directly
```bash
python agent.py
python agent.py "https://trends.google.com/trends/explore?q=wow&hl=en-US"
python agent.py "copa do mundo da fifa 2026" --date "now 1-d" --geo BR
```
The script starts SeleniumBase with `SB(uc=True, test=True, use_chromium=True)`,
uses the SeleniumBase UC reconnect path by default, activates CDP mode, attaches
Playwright over CDP, performs SeleniumBase GUI mouse movement plus
mouse/scroll/keyboard warmup, and prints JSON with the requested URL, final URL,
page title, visible text, and a screenshot path under `outputs/google-trends.png`.
Pass `--chrome` to use system Chrome instead of SeleniumBase Chromium.
Pass `--incognito` or `--guest` only when you explicitly want those browser
modes.
Pass `--no-humanize` to skip the mouse, scroll, and keyboard warmup.
Pass `--open-mode cdp-goto` to use the direct CDP navigation path instead of
the default SeleniumBase UC reconnect path. `--reconnect-time` controls the UC
disconnect window used by `uc_open_with_reconnect()`.
## Run as A2A
```bash
a2a dev
a2a test --invoke --skill fetch --args-json '{"task":"https://trends.google.com/trends/explore?q=wow&hl=en-US"}'
```