# yiromo/pytrends-modern architecture

> Architecture diagram of the GitHub repository yiromo/pytrends-modern, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yiromo/pytrends-modern
- Repository: https://github.com/yiromo/pytrends-modern

## Overview

pytrends-modern is a Python client library for Google Trends data, with HTTP and browser-backed API access plus separate RSS and Selenium scraping routes. Its principal workflow configures a query, retrieves Google Trends data, and parses it into usable results; async access and browser sign-in extend that route. The README also documents trending analysis and CLI access. Arrows reflect the sampled excerpts and explicit README claims; unsampled implementations are represented only where the tree and README establish the capability.

Main entry points: [`pytrends_modern/__init__.py`](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/__init__.py) (Public exports), [`pytrends_modern/request.py`](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/request.py) (TrendReq client), [`pytrends_modern/request_async.py`](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/request_async.py) (Async client), [`pytrends_modern/rss.py`](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/rss.py) (RSS trends)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Trends API"]
  node_trendreq["TrendReq client<br/>[request.py]"]
  node_async_req["Async client<br/>[request_async.py]"]
  node_api_config["API configuration<br/>[config.py]"]
  node_utilities["Data utilities<br/>[utils.py]"]
  node_errors["Exceptions<br/>[exceptions.py]"]
end

subgraph group_browser["Browser Access"]
  node_browser_config["Browser settings"]
  node_legacy_browser_config["Browser config<br/>[browser_config.py]"]
  node_signin_setup["Sign-in setup<br/>[camoufox_setup.py]"]
  node_proxy_extension["Proxy extension<br/>[proxy_extension.py]"]
end

subgraph group_feeds["Trending Sources"]
  node_rss["RSS trends<br/>[rss.py]"]
  node_scraper["Selenium scraper<br/>[scraper.py]"]
end

subgraph group_interfaces["User Interfaces"]
  node_cli["Command line<br/>[cli.py]"]
  node_library_exports["Public exports<br/>[__init__.py]"]
end

node_developer(("Library user"))
node_google_trends{{"Google Trends"}}

node_developer -->|"builds queries"| node_trendreq
node_trendreq -->|"requests data"| node_google_trends
node_google_trends -->|"returns responses"| node_trendreq
node_developer -->|"uses async"| node_async_req
node_async_req -->|"requests data"| node_google_trends
node_async_req -->|"runs sign-in"| node_signin_setup
node_developer -->|"requests trends"| node_rss
node_rss -->|"fetches RSS"| node_google_trends
node_developer -->|"requests export"| node_scraper
node_scraper -->|"downloads CSV"| node_google_trends
node_developer -->|"runs commands"| node_cli
node_cli -->|"queries API"| node_trendreq
node_cli -->|"requests feeds"| node_rss
node_developer -->|"imports library"| node_library_exports
node_library_exports -->|"exports client"| node_trendreq
node_library_exports -->|"exports client"| node_async_req
node_library_exports -->|"exports feed"| node_rss
node_library_exports -->|"exports settings"| node_browser_config
node_library_exports -->|"exports scraper"| node_scraper
node_browser_config -.->|"configures sign-in"| node_signin_setup

click node_trendreq "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/request.py"
click node_async_req "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/request_async.py"
click node_api_config "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/config.py"
click node_utilities "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/utils.py"
click node_errors "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/exceptions.py"
click node_browser_config "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/browser_config_camoufox.py"
click node_legacy_browser_config "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/browser_config.py"
click node_signin_setup "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/camoufox_setup.py"
click node_proxy_extension "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/proxy_extension.py"
click node_rss "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/rss.py"
click node_scraper "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/scraper.py"
click node_cli "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/cli.py"
click node_library_exports "https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/__init__.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_trendreq,node_async_req,node_api_config,node_utilities,node_errors,node_developer toneBlue
class node_browser_config,node_legacy_browser_config,node_signin_setup,node_proxy_extension toneAmber
class node_rss,node_scraper toneMint
class node_cli,node_library_exports toneRose
class node_google_trends toneIndigo
```

## Components

### Trends API

- [TrendReq client](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/request.py): `pytrends_modern/request.py`
- [Async client](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/request_async.py): `pytrends_modern/request_async.py`
- [API configuration](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/config.py): `pytrends_modern/config.py`
- [Data utilities](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/utils.py): `pytrends_modern/utils.py`
- [Exceptions](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/exceptions.py): `pytrends_modern/exceptions.py`

### Browser Access

- [Browser settings](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/browser_config_camoufox.py): `pytrends_modern/browser_config_camoufox.py`
- [Browser config](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/browser_config.py): `pytrends_modern/browser_config.py`
- [Sign-in setup](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/camoufox_setup.py): `pytrends_modern/camoufox_setup.py`
- [Proxy extension](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/proxy_extension.py): `pytrends_modern/proxy_extension.py`

### Trending Sources

- [RSS trends](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/rss.py): `pytrends_modern/rss.py`
- [Selenium scraper](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/scraper.py): `pytrends_modern/scraper.py`

### User Interfaces

- [Command line](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/cli.py): `pytrends_modern/cli.py`
- [Public exports](https://github.com/yiromo/pytrends-modern/blob/main/pytrends_modern/__init__.py): `pytrends_modern/__init__.py`

### Other components

- **Library user**
- **Google Trends**

## Connections

- Library user → TrendReq client: builds queries (evidence: `README.md`)
- TrendReq client → Google Trends: requests data (evidence: `README.md`)
- Google Trends → TrendReq client: returns responses (evidence: `pytrends_modern/request.py`)
- Library user → Async client: uses async (evidence: `README.md`)
- Async client → Google Trends: requests data (evidence: `README.md`)
- Async client → Sign-in setup: runs sign-in (evidence: `pytrends_modern/request_async.py`)
- Library user → RSS trends: requests trends (evidence: `README.md`)
- RSS trends → Google Trends: fetches RSS (evidence: `pytrends_modern/rss.py`)
- Library user → Selenium scraper: requests export (evidence: `README.md`)
- Selenium scraper → Google Trends: downloads CSV (evidence: `pytrends_modern/scraper.py`)
- Library user → Command line: runs commands (evidence: `README.md`)
- Command line → TrendReq client: queries API (evidence: `README.md`)
- Command line → RSS trends: requests feeds (evidence: `README.md`)
- Library user → Public exports: imports library (evidence: `pytrends_modern/__init__.py`)
- Public exports → TrendReq client: exports client (evidence: `pytrends_modern/__init__.py`)
- Public exports → Async client: exports client (evidence: `pytrends_modern/__init__.py`)
- Public exports → RSS trends: exports feed (evidence: `pytrends_modern/__init__.py`)
- Public exports → Browser settings: exports settings (evidence: `pytrends_modern/__init__.py`)
- Public exports → Selenium scraper: exports scraper (evidence: `pytrends_modern/__init__.py`)
- Browser settings → Sign-in setup: configures sign-in (evidence: `README.md`)
