trendspyg 0.2.0__tar.gz
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.
- trendspyg-0.2.0/LICENSE +21 -0
- trendspyg-0.2.0/PKG-INFO +639 -0
- trendspyg-0.2.0/README.md +593 -0
- trendspyg-0.2.0/pyproject.toml +116 -0
- trendspyg-0.2.0/setup.cfg +4 -0
- trendspyg-0.2.0/trendspyg/__init__.py +32 -0
- trendspyg-0.2.0/trendspyg/config.py +236 -0
- trendspyg-0.2.0/trendspyg/downloader.py +611 -0
- trendspyg-0.2.0/trendspyg/exceptions.py +62 -0
- trendspyg-0.2.0/trendspyg/rss_downloader.py +373 -0
- trendspyg-0.2.0/trendspyg/utils.py +38 -0
- trendspyg-0.2.0/trendspyg/version.py +4 -0
- trendspyg-0.2.0/trendspyg.egg-info/PKG-INFO +639 -0
- trendspyg-0.2.0/trendspyg.egg-info/SOURCES.txt +15 -0
- trendspyg-0.2.0/trendspyg.egg-info/dependency_links.txt +1 -0
- trendspyg-0.2.0/trendspyg.egg-info/requires.txt +19 -0
- trendspyg-0.2.0/trendspyg.egg-info/top_level.txt +1 -0
trendspyg-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AM
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
trendspyg-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,639 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: trendspyg
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Free, open-source Python library for real-time Google Trends data with time filtering - pytrends alternative with 188K+ configurations
|
|
5
|
+
Author-email: flack0x <ali.marodis2@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/flack0x/trendspyg
|
|
8
|
+
Project-URL: Documentation, https://github.com/flack0x/trendspyg#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/flack0x/trendspyg
|
|
10
|
+
Project-URL: Issues, https://github.com/flack0x/trendspyg/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/flack0x/trendspyg/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: google-trends,trends,pytrends,data-analysis,seo,marketing,analytics
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Internet
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
26
|
+
Requires-Python: >=3.8
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: selenium>=4.15.0
|
|
30
|
+
Requires-Dist: requests>=2.31.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-mock>=3.11.1; extra == "dev"
|
|
35
|
+
Requires-Dist: black>=23.7.0; extra == "dev"
|
|
36
|
+
Requires-Dist: flake8>=6.1.0; extra == "dev"
|
|
37
|
+
Requires-Dist: mypy>=1.5.0; extra == "dev"
|
|
38
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
39
|
+
Provides-Extra: cli
|
|
40
|
+
Requires-Dist: click>=8.0.0; extra == "cli"
|
|
41
|
+
Requires-Dist: tqdm>=4.65.0; extra == "cli"
|
|
42
|
+
Provides-Extra: analysis
|
|
43
|
+
Requires-Dist: pandas>=2.0.0; extra == "analysis"
|
|
44
|
+
Requires-Dist: pyarrow>=10.0.0; extra == "analysis"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# trendspyg
|
|
48
|
+
|
|
49
|
+
[](https://www.python.org/downloads/)
|
|
50
|
+
[](https://opensource.org/licenses/MIT)
|
|
51
|
+
|
|
52
|
+
**Free, open-source Python library for real-time Google Trends data** - a modern alternative to the archived pytrends with **188,000+ configuration options**.
|
|
53
|
+
|
|
54
|
+
> **Note:** pytrends was archived on April 17, 2025 with no replacement. trendspyg is built to fill this gap with enhanced features and active maintenance.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## β¨ Features
|
|
59
|
+
|
|
60
|
+
### Trending Now (Real-time Data)
|
|
61
|
+
- π₯ **"Trending now" data** - Real-time trending searches from Google Trends
|
|
62
|
+
- π **114 countries** supported
|
|
63
|
+
- πΊοΈ **51 US states** + sub-regions
|
|
64
|
+
- π **20 categories** (sports, entertainment, technology, etc.)
|
|
65
|
+
- β° **4 time periods** (4h, 24h, 48h, 7 days)
|
|
66
|
+
- π **Frequent updates** - RSS updates ~9 times/hour, CSV exports ~every minute
|
|
67
|
+
- π― **Active trends filtering** - Show only rising trends
|
|
68
|
+
- π **4 sort options** (relevance, title, volume, recency)
|
|
69
|
+
- πΎ **4 output formats** - CSV, JSON, Parquet, DataFrame
|
|
70
|
+
- π¨ **Full type hints** - Complete IDE support with IntelliSense
|
|
71
|
+
- π¦ **Easy installation** - just `pip install trendspyg`
|
|
72
|
+
- π **100% free** and open-source
|
|
73
|
+
|
|
74
|
+
**Total combinations: 188,000+**
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## π Quick Start
|
|
79
|
+
|
|
80
|
+
### Installation
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install trendspyg
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Two Data Sources - Choose Your Path
|
|
87
|
+
|
|
88
|
+
trendspyg provides **two complementary ways** to access Google Trends data:
|
|
89
|
+
|
|
90
|
+
#### π **Fast Path: RSS Feed** (Recommended for most users)
|
|
91
|
+
- β‘ **0.2 seconds** - 50x faster than CSV
|
|
92
|
+
- π° **Rich media**: News articles, headlines, images
|
|
93
|
+
- π **Perfect for**: Real-time monitoring, journalism, qualitative research
|
|
94
|
+
- β οΈ **Limitation**: ~10-20 trends, no filtering
|
|
95
|
+
|
|
96
|
+
#### π **Full Path: CSV Export**
|
|
97
|
+
- π **480 trends** - Comprehensive dataset
|
|
98
|
+
- β±οΈ **Time filtering**: 4h, 24h, 48h, 7 days
|
|
99
|
+
- π― **Category filtering**: Sports, tech, etc.
|
|
100
|
+
- π **~10 seconds** - Requires browser automation
|
|
101
|
+
- π **Perfect for**: Statistical analysis, research papers, large datasets
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### Quick Examples
|
|
106
|
+
|
|
107
|
+
#### RSS - Fast & Rich Media (0.2s)
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from trendspyg import download_google_trends_rss
|
|
111
|
+
|
|
112
|
+
# Get current trends with news articles & images
|
|
113
|
+
trends = download_google_trends_rss(geo='US')
|
|
114
|
+
|
|
115
|
+
# Access rich data
|
|
116
|
+
for trend in trends[:3]:
|
|
117
|
+
print(f"\n{trend['trend']} ({trend['traffic']})")
|
|
118
|
+
print(f" π° {len(trend['news_articles'])} news articles")
|
|
119
|
+
print(f" πΈ Image: {trend['image']['source']}")
|
|
120
|
+
if trend['news_articles']:
|
|
121
|
+
print(f" Headline: {trend['news_articles'][0]['headline']}")
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Output:**
|
|
125
|
+
```
|
|
126
|
+
christine donohue (500+)
|
|
127
|
+
π° 3 news articles
|
|
128
|
+
πΈ Image: Fox News
|
|
129
|
+
Headline: What to expect for the Nov. 4 election in Pennsylvania
|
|
130
|
+
|
|
131
|
+
spot stock (200+)
|
|
132
|
+
π° 3 news articles
|
|
133
|
+
πΈ Image: Yahoo Finance
|
|
134
|
+
Headline: SPOT Stock Alert: Why Shares of Spotify Are Moving Today
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### CSV - Comprehensive & Filtered (10s)
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from trendspyg import download_google_trends_csv
|
|
141
|
+
|
|
142
|
+
# California, past 7 days, sports only, DataFrame format
|
|
143
|
+
df = download_google_trends_csv(
|
|
144
|
+
geo='US-CA', # State-level support!
|
|
145
|
+
hours=168, # 7 days
|
|
146
|
+
category='sports', # Filter by category
|
|
147
|
+
active_only=True, # Only rising trends
|
|
148
|
+
output_format='dataframe' # pandas DataFrame
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
print(f"Found {len(df)} sports trends in California")
|
|
152
|
+
# Found 480 sports trends in California
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
### Prerequisites
|
|
158
|
+
|
|
159
|
+
**For RSS (Fast Path):**
|
|
160
|
+
- β
Python 3.8+
|
|
161
|
+
- β
Internet connection
|
|
162
|
+
- β
That's it!
|
|
163
|
+
|
|
164
|
+
**For CSV (Full Path) - Additionally Requires:**
|
|
165
|
+
- π **Chrome Browser** - [Download here](https://www.google.com/chrome/)
|
|
166
|
+
- π¦ ChromeDriver (auto-managed by Selenium)
|
|
167
|
+
|
|
168
|
+
### Multiple Output Formats
|
|
169
|
+
|
|
170
|
+
Choose from **4 output formats** to match your workflow:
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from trendspyg.downloader import download_google_trends_csv
|
|
174
|
+
|
|
175
|
+
# CSV (default) - Universal compatibility
|
|
176
|
+
csv_file = download_google_trends_csv(geo='US', output_format='csv')
|
|
177
|
+
|
|
178
|
+
# JSON - Perfect for APIs and web apps
|
|
179
|
+
json_file = download_google_trends_csv(geo='US', output_format='json')
|
|
180
|
+
|
|
181
|
+
# Parquet - Efficient storage (50-80% smaller than CSV)
|
|
182
|
+
parquet_file = download_google_trends_csv(geo='US', output_format='parquet')
|
|
183
|
+
|
|
184
|
+
# DataFrame - Immediate analysis, no file I/O
|
|
185
|
+
import pandas as pd
|
|
186
|
+
df = download_google_trends_csv(geo='US', output_format='dataframe')
|
|
187
|
+
print(df.head())
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Installation for all formats:**
|
|
191
|
+
```bash
|
|
192
|
+
pip install trendspyg[analysis] # Includes pandas + pyarrow
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
| Format | Best For | File Size | Requires |
|
|
196
|
+
|--------|----------|-----------|----------|
|
|
197
|
+
| **CSV** | Excel, universal compatibility | Medium | Built-in |
|
|
198
|
+
| **JSON** | APIs, JavaScript, NoSQL | Large | pandas |
|
|
199
|
+
| **Parquet** | Big data, data lakes | Small (50-80% less) | pandas + pyarrow |
|
|
200
|
+
| **DataFrame** | In-memory analysis | N/A | pandas |
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## π Data Sources Explained
|
|
205
|
+
|
|
206
|
+
### Choose Your Data Source
|
|
207
|
+
|
|
208
|
+
trendspyg provides **both RSS and CSV** - they're complementary, not competing!
|
|
209
|
+
|
|
210
|
+
| Feature | RSS Feed π | CSV Export π |
|
|
211
|
+
|---------|-------------|---------------|
|
|
212
|
+
| **Speed** | 0.2 seconds | ~10 seconds |
|
|
213
|
+
| **Trends Count** | ~10-20 | 480 |
|
|
214
|
+
| **News Articles** | β
3-5 per trend | β No |
|
|
215
|
+
| **Article Headlines** | β
Yes | β No |
|
|
216
|
+
| **Article URLs** | β
Yes | β No |
|
|
217
|
+
| **Images** | β
Trend images | β No |
|
|
218
|
+
| **News Sources** | β
Yes (e.g., "CNN", "BBC") | β No |
|
|
219
|
+
| **Start/End Times** | β No | β
Yes |
|
|
220
|
+
| **Related Searches** | β No | β
Yes (comma-separated) |
|
|
221
|
+
| **Time Filtering** | β No (current only) | β
Yes (4h/24h/48h/7d) |
|
|
222
|
+
| **Category Filter** | β No | β
Yes (20 categories) |
|
|
223
|
+
| **Active-Only Filter** | β No | β
Yes |
|
|
224
|
+
| **Sort Options** | β No | β
Yes (4 options) |
|
|
225
|
+
| **Chrome Required** | β No | β
Yes |
|
|
226
|
+
| **Best For** | Journalism, monitoring | Research, statistics |
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### What Data Each Source Provides
|
|
231
|
+
|
|
232
|
+
#### π° RSS Feed Data Structure
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
{
|
|
236
|
+
"trend": "xrp",
|
|
237
|
+
"traffic": "200+",
|
|
238
|
+
"published": "2025-11-04 04:00:00",
|
|
239
|
+
"image": {
|
|
240
|
+
"url": "https://encrypted-tbn0.gstatic.com/...",
|
|
241
|
+
"source": "CoinDesk" # Image source
|
|
242
|
+
},
|
|
243
|
+
"news_articles": [
|
|
244
|
+
{
|
|
245
|
+
"headline": "XRP Price News: Ripple-Linked Token Approaches 'Death Cross'",
|
|
246
|
+
"url": "https://www.coindesk.com/markets/2025/11/04/xrp-nears-death-cross",
|
|
247
|
+
"source": "CoinDesk",
|
|
248
|
+
"image": "https://encrypted-tbn0.gstatic.com/..."
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"headline": "Why XRP Is Going Down? Crypto Falls Today...",
|
|
252
|
+
"url": "https://www.financemagnates.com/...",
|
|
253
|
+
"source": "Finance Magnates",
|
|
254
|
+
"image": "https://..."
|
|
255
|
+
}
|
|
256
|
+
// ... 3-5 articles per trend
|
|
257
|
+
],
|
|
258
|
+
"explore_link": "https://trends.google.com/trends/explore?q=xrp"
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Why RSS is Valuable for Researchers:**
|
|
263
|
+
- β
**Qualitative Analysis**: Read actual news articles explaining trends
|
|
264
|
+
- β
**Source Validation**: Verify trends with credible news sources
|
|
265
|
+
- β
**Visual Content**: Images for presentations/papers
|
|
266
|
+
- β
**Fast Data Collection**: 0.2s enables frequent polling (every 5 min)
|
|
267
|
+
- β
**Citation Material**: Article URLs as references
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
#### π CSV Export Data Structure
|
|
272
|
+
|
|
273
|
+
```csv
|
|
274
|
+
"Trends","Search volume","Started","Ended","Trend breakdown","Explore link"
|
|
275
|
+
"cowboys","2M+","November 4, 2025 at 1:50:00 AM UTC+2",,"cowboys,dallas cowboys,cowboys game,jacoby brissett,...","https://..."
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**CSV Columns:**
|
|
279
|
+
- **Trends**: Main search keyword
|
|
280
|
+
- **Search volume**: Popularity tier (50K+, 100K+, 200K+, 500K+, 1M+, 2M+)
|
|
281
|
+
- **Started**: When trend began trending (timestamp)
|
|
282
|
+
- **Ended**: When trend stopped (usually empty for active trends)
|
|
283
|
+
- **Trend breakdown**: Related search terms (comma-separated list)
|
|
284
|
+
- **Explore link**: Direct Google Trends analysis URL
|
|
285
|
+
|
|
286
|
+
**Why CSV is Valuable for Researchers:**
|
|
287
|
+
- β
**Quantitative Analysis**: 480 trends for statistical significance
|
|
288
|
+
- β
**Historical Context**: Start/end times for temporal analysis
|
|
289
|
+
- β
**Time-based Studies**: Filter by 4h/24h/48h/7d periods
|
|
290
|
+
- β
**Semantic Analysis**: Related searches reveal topic clusters
|
|
291
|
+
- β
**Large Datasets**: Sufficient N for statistical tests
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
### π Research Use Cases - When to Use Each
|
|
296
|
+
|
|
297
|
+
#### Use RSS When You Need:
|
|
298
|
+
|
|
299
|
+
**1. Journalism & Breaking News**
|
|
300
|
+
```python
|
|
301
|
+
# Monitor trends every 5 minutes for breaking stories
|
|
302
|
+
trends = download_google_trends_rss('US')
|
|
303
|
+
for trend in trends:
|
|
304
|
+
if trend['traffic'].startswith('1M'): # Major spike
|
|
305
|
+
print(f"π¨ ALERT: {trend['trend']}")
|
|
306
|
+
print(f" Source: {trend['news_articles'][0]['source']}")
|
|
307
|
+
print(f" Read: {trend['news_articles'][0]['url']}")
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**2. Qualitative Research - Content Analysis**
|
|
311
|
+
```python
|
|
312
|
+
# Collect news articles about trending topics for discourse analysis
|
|
313
|
+
import pandas as pd
|
|
314
|
+
|
|
315
|
+
trends = download_google_trends_rss('US', output_format='dataframe')
|
|
316
|
+
|
|
317
|
+
# Analyze news sources
|
|
318
|
+
for idx, row in trends.iterrows():
|
|
319
|
+
articles = row['news_articles']
|
|
320
|
+
sources = [a['source'] for a in articles]
|
|
321
|
+
print(f"{row['trend']}: Coverage by {', '.join(sources)}")
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**3. Visual Presentations**
|
|
325
|
+
```python
|
|
326
|
+
# Get images for your research presentation
|
|
327
|
+
trends = download_google_trends_rss('US')
|
|
328
|
+
|
|
329
|
+
# Download trend images
|
|
330
|
+
for trend in trends[:5]:
|
|
331
|
+
image_url = trend['image']['url']
|
|
332
|
+
image_source = trend['image']['source']
|
|
333
|
+
# Use in slides with proper attribution
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
#### Use CSV When You Need:
|
|
339
|
+
|
|
340
|
+
**1. Statistical Analysis - Academic Papers**
|
|
341
|
+
```python
|
|
342
|
+
# Large dataset for statistical significance
|
|
343
|
+
df = download_google_trends_csv(
|
|
344
|
+
geo='US',
|
|
345
|
+
hours=168, # Past week
|
|
346
|
+
output_format='dataframe'
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
print(f"N = {len(df)} trends") # N = 480
|
|
350
|
+
|
|
351
|
+
# Analyze search volume distribution
|
|
352
|
+
import matplotlib.pyplot as plt
|
|
353
|
+
df['search_volume'].value_counts().plot(kind='bar')
|
|
354
|
+
plt.title('Search Volume Distribution (n=480)')
|
|
355
|
+
plt.show()
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**2. Time-Series Studies**
|
|
359
|
+
```python
|
|
360
|
+
# Study how trends change over different time periods
|
|
361
|
+
periods = [4, 24, 48, 168] # 4h, 1d, 2d, 7d
|
|
362
|
+
|
|
363
|
+
for period in periods:
|
|
364
|
+
df = download_google_trends_csv(
|
|
365
|
+
geo='US',
|
|
366
|
+
hours=period,
|
|
367
|
+
category='health',
|
|
368
|
+
output_format='dataframe'
|
|
369
|
+
)
|
|
370
|
+
print(f"{period}h: {len(df)} health trends")
|
|
371
|
+
# Analyze temporal patterns
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**3. Semantic Network Analysis**
|
|
375
|
+
```python
|
|
376
|
+
# Build topic networks from related searches
|
|
377
|
+
df = download_google_trends_csv('US', output_format='dataframe')
|
|
378
|
+
|
|
379
|
+
# Extract related terms
|
|
380
|
+
for idx, row in df.iterrows():
|
|
381
|
+
main_term = row['Trends']
|
|
382
|
+
related = row['Trend breakdown'].split(',')
|
|
383
|
+
# Build graph: main_term -> related terms
|
|
384
|
+
# Use for network visualization
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
#### Use BOTH for Mixed-Methods Research
|
|
390
|
+
|
|
391
|
+
**Example: "Why did Bitcoin spike?"**
|
|
392
|
+
|
|
393
|
+
```python
|
|
394
|
+
# Step 1: RSS - Get qualitative context (fast)
|
|
395
|
+
trends = download_google_trends_rss('US')
|
|
396
|
+
bitcoin_trend = [t for t in trends if 'bitcoin' in t['trend'].lower()][0]
|
|
397
|
+
|
|
398
|
+
print("Qualitative Context:")
|
|
399
|
+
for article in bitcoin_trend['news_articles']:
|
|
400
|
+
print(f"- {article['headline']}")
|
|
401
|
+
print(f" Source: {article['source']}")
|
|
402
|
+
|
|
403
|
+
# Step 2: CSV - Get quantitative data (comprehensive)
|
|
404
|
+
df = download_google_trends_csv(
|
|
405
|
+
geo='US',
|
|
406
|
+
hours=168,
|
|
407
|
+
category='all',
|
|
408
|
+
output_format='dataframe'
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
crypto_trends = df[df['Trends'].str.contains('bitcoin|crypto|btc', case=False)]
|
|
412
|
+
print(f"\nQuantitative Data: {len(crypto_trends)} crypto-related trends")
|
|
413
|
+
print(f"Related searches: {crypto_trends.iloc[0]['Trend breakdown']}")
|
|
414
|
+
|
|
415
|
+
# Result: Complete picture with both narrative (RSS) and numbers (CSV)
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
### CSV Output Format
|
|
421
|
+
|
|
422
|
+
Each download returns a CSV file with the following columns:
|
|
423
|
+
|
|
424
|
+
| Column | Description | Example |
|
|
425
|
+
|--------|-------------|---------|
|
|
426
|
+
| **Trends** | Main search keyword | "bills", "vikings vs lions" |
|
|
427
|
+
| **Search volume** | Popularity tier | 50K+, 100K+, 200K+, 500K+, 1M+ |
|
|
428
|
+
| **Started** | When trend started | "November 2, 2025 at 11:00:00 PM UTC+2" |
|
|
429
|
+
| **Ended** | When trend ended (if applicable) | Usually empty for active trends |
|
|
430
|
+
| **Trend breakdown** | Related search terms (comma-separated) | "buffalo bills,bills chiefs,josh allen,..." |
|
|
431
|
+
| **Explore link** | Direct Google Trends URL | https://trends.google.com/trends/explore?q=... |
|
|
432
|
+
|
|
433
|
+
### Example Output
|
|
434
|
+
|
|
435
|
+
```csv
|
|
436
|
+
"Trends","Search volume","Started","Ended","Trend breakdown","Explore link"
|
|
437
|
+
"bills","1M+","November 2, 2025 at 11:00:00 PM UTC+2",,"buffalo bills,kansas city chiefs vs buffalo bills,bills chiefs,josh allen,...","https://trends.google.com/trends/explore?q=bills&geo=US&hl=en-US"
|
|
438
|
+
"vikings vs lions","1M+","November 2, 2025 at 3:20:00 PM UTC+2",,"lions vs vikings,detroit lions,lions game,vikings game,...","https://trends.google.com/trends/explore?q=vikings%20vs%20lions&geo=US&hl=en-US"
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Why This Data is Valuable
|
|
442
|
+
|
|
443
|
+
- **Real-time insights** - See what's trending RIGHT NOW
|
|
444
|
+
- **Search volume tiers** - Gauge popularity at a glance
|
|
445
|
+
- **Related keywords** - Discover content ideas and variations (perfect for SEO)
|
|
446
|
+
- **Direct exploration** - Click through to deep-dive any trend
|
|
447
|
+
- **Easy analysis** - CSV format works with Excel, Python, R, or any data tool
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## π Why trendspyg?
|
|
452
|
+
|
|
453
|
+
| Feature | trendspyg | pytrends | Commercial APIs |
|
|
454
|
+
|---------|-----------|----------|-----------------|
|
|
455
|
+
| **Status** | β
Active | β Archived (April 2025) | β
Active |
|
|
456
|
+
| **Price** | **FREE** | FREE | $0.003-$0.015/request |
|
|
457
|
+
| **Countries** | **114** | ~50 | All |
|
|
458
|
+
| **US States** | **51** | β None | Some |
|
|
459
|
+
| **Categories** | **20** | Limited | All |
|
|
460
|
+
| **Configurations** | **188,000+** | ~1,000 | Many |
|
|
461
|
+
| **Real-time Monitoring** | β
Every ~1 min | β | β |
|
|
462
|
+
| **Maintained** | β
Yes | β No | β
Yes |
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## π Supported Options
|
|
467
|
+
|
|
468
|
+
### Countries (114 total)
|
|
469
|
+
US, CA, UK, AU, IN, JP, DE, FR, BR, MX, ES, IT, RU, KR, and 100+ more
|
|
470
|
+
|
|
471
|
+
### US States (51 total)
|
|
472
|
+
US-AL, US-AK, US-AZ, US-AR, US-CA, US-CO, US-CT, US-DE, US-DC, US-FL, US-GA, US-HI, US-ID, US-IL, US-IN, US-IA, US-KS, US-KY, US-LA, US-ME, US-MD, US-MA, US-MI, US-MN, US-MS, US-MO, US-MT, US-NE, US-NV, US-NH, US-NJ, US-NM, US-NY, US-NC, US-ND, US-OH, US-OK, US-OR, US-PA, US-RI, US-SC, US-SD, US-TN, US-TX, US-UT, US-VT, US-VA, US-WA, US-WV, US-WI, US-WY
|
|
473
|
+
|
|
474
|
+
### Categories (20 total)
|
|
475
|
+
all, sports, entertainment, business, politics, technology, health, science, games, shopping, food, travel, beauty, hobbies, climate, jobs, law, pets, autos, other
|
|
476
|
+
|
|
477
|
+
### Time Periods
|
|
478
|
+
- **4 hours** - Breaking trends
|
|
479
|
+
- **24 hours** - Daily summary (default)
|
|
480
|
+
- **48 hours** - 2-day overview
|
|
481
|
+
- **7 days** - Weekly trends
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
## π Documentation
|
|
486
|
+
|
|
487
|
+
- **[Complete Options Reference](COMPLETE_OPTIONS_REFERENCE.md)** - All 188K+ configurations
|
|
488
|
+
- **[Changelog](CHANGELOG.md)** - Version history
|
|
489
|
+
- **[Roadmap](ROADMAP.md)** - Public feature roadmap
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## π€ Contributing
|
|
494
|
+
|
|
495
|
+
Contributions are welcome! This project was born from the need to replace the archived pytrends.
|
|
496
|
+
|
|
497
|
+
**Ways to contribute:**
|
|
498
|
+
- Report bugs
|
|
499
|
+
- Suggest features
|
|
500
|
+
- Submit pull requests
|
|
501
|
+
- Improve documentation
|
|
502
|
+
- Share your use cases
|
|
503
|
+
|
|
504
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## π Use Cases
|
|
509
|
+
|
|
510
|
+
- **Marketing & SEO** - Keyword research, trend analysis
|
|
511
|
+
- **Journalism** - Breaking news validation, public sentiment
|
|
512
|
+
- **Academic Research** - Economic forecasting, social trends
|
|
513
|
+
- **Trading & Finance** - Market sentiment analysis
|
|
514
|
+
- **Data Analysis** - Dashboards, visualizations
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
## π§ Troubleshooting
|
|
519
|
+
|
|
520
|
+
### Common Issues
|
|
521
|
+
|
|
522
|
+
**"Chrome browser not found" or "WebDriver error"**
|
|
523
|
+
```
|
|
524
|
+
Solution:
|
|
525
|
+
1. Install Chrome browser: https://www.google.com/chrome/
|
|
526
|
+
2. Ensure Chrome is in your PATH
|
|
527
|
+
3. Update trendspyg: pip install --upgrade trendspyg
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
**"Invalid geo code" error**
|
|
531
|
+
```python
|
|
532
|
+
# β Wrong
|
|
533
|
+
download_google_trends_csv(geo="USA") # Should be "US"
|
|
534
|
+
|
|
535
|
+
# β
Correct
|
|
536
|
+
download_google_trends_csv(geo="US") # Two-letter country code
|
|
537
|
+
```
|
|
538
|
+
See all valid codes: `from trendspyg.config import COUNTRIES, US_STATES`
|
|
539
|
+
|
|
540
|
+
**"Invalid hours value" error**
|
|
541
|
+
```python
|
|
542
|
+
# β Wrong
|
|
543
|
+
download_google_trends_csv(hours=12) # Not supported
|
|
544
|
+
|
|
545
|
+
# β
Correct - Use one of: 4, 24, 48, 168
|
|
546
|
+
download_google_trends_csv(hours=24) # Past 24 hours
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
**"No such element" or UI changed**
|
|
550
|
+
```
|
|
551
|
+
This means Google Trends changed their website layout.
|
|
552
|
+
|
|
553
|
+
Solution:
|
|
554
|
+
1. Update trendspyg: pip install --upgrade trendspyg
|
|
555
|
+
2. Check GitHub issues: https://github.com/flack0x/trendspyg/issues
|
|
556
|
+
3. Report the issue if not already reported
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
**Download timeout or slow connection**
|
|
560
|
+
- The library automatically retries 3 times with exponential backoff
|
|
561
|
+
- Increase wait time if on slow connection (this is automatic)
|
|
562
|
+
- Check if trends.google.com is accessible in your browser
|
|
563
|
+
|
|
564
|
+
**File not downloading**
|
|
565
|
+
```
|
|
566
|
+
Check:
|
|
567
|
+
- Download directory permissions
|
|
568
|
+
- Antivirus/firewall not blocking
|
|
569
|
+
- Disk space available
|
|
570
|
+
- Default: ./downloads/ folder
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
### Getting Help
|
|
574
|
+
|
|
575
|
+
1. **Check Error Message** - Error messages include specific solutions
|
|
576
|
+
2. **Search Issues** - [GitHub Issues](https://github.com/flack0x/trendspyg/issues)
|
|
577
|
+
3. **Report Bug** - Include full error message and code snippet
|
|
578
|
+
4. **Ask Community** - [GitHub Discussions](https://github.com/flack0x/trendspyg/discussions)
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
## πΊοΈ Roadmap
|
|
583
|
+
|
|
584
|
+
### v0.2.0 (Current)
|
|
585
|
+
- β
"Trending now" data downloads (RSS feed + CSV export)
|
|
586
|
+
- β
188,000+ configuration options
|
|
587
|
+
- β
114 countries + 51 US states
|
|
588
|
+
- β
4 output formats (CSV, JSON, Parquet, DataFrame)
|
|
589
|
+
- β
Full type hints
|
|
590
|
+
- β
Active trends filtering
|
|
591
|
+
|
|
592
|
+
### v0.3.0 (Coming Soon)
|
|
593
|
+
- [ ] CLI tool (`trendspyg download --geo US-CA`)
|
|
594
|
+
- [ ] Real-time monitoring mode
|
|
595
|
+
- [ ] Batch downloads
|
|
596
|
+
- [ ] Enhanced error handling
|
|
597
|
+
- [ ] Caching layer
|
|
598
|
+
|
|
599
|
+
### v0.4.0 (Future)
|
|
600
|
+
- [ ] Async support
|
|
601
|
+
- [ ] Data visualization helpers
|
|
602
|
+
- [ ] Historical data archiving
|
|
603
|
+
- [ ] Advanced filtering options
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
## π License
|
|
608
|
+
|
|
609
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
## π Acknowledgments
|
|
614
|
+
|
|
615
|
+
- Built as a successor to **pytrends** (GeneralMills/pytrends) which was archived April 17, 2025
|
|
616
|
+
- Inspired by the 200,000+ monthly users who need reliable Google Trends data access
|
|
617
|
+
- Thanks to the open-source community for making this possible
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
## π Support
|
|
622
|
+
|
|
623
|
+
- **Issues:** [GitHub Issues](https://github.com/flack0x/trendspyg/issues)
|
|
624
|
+
- **Discussions:** [GitHub Discussions](https://github.com/flack0x/trendspyg/discussions)
|
|
625
|
+
- **Documentation:** [GitHub Wiki](https://github.com/flack0x/trendspyg/wiki)
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
629
|
+
## β Star History
|
|
630
|
+
|
|
631
|
+
If you find trendspyg useful, please consider starring the repository!
|
|
632
|
+
|
|
633
|
+
[](https://star-history.com/#flack0x/trendspyg&Date)
|
|
634
|
+
|
|
635
|
+
---
|
|
636
|
+
|
|
637
|
+
**Built with β€οΈ for the data community**
|
|
638
|
+
|
|
639
|
+
*trendspyg - Spy on trends, not on users. Free forever.*
|