trendscout 0.3.0__tar.gz → 1.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.
- trendscout-1.2.0/PKG-INFO +259 -0
- trendscout-1.2.0/README.md +228 -0
- {trendscout-0.3.0 → trendscout-1.2.0}/pyproject.toml +10 -3
- trendscout-1.2.0/tests/test_basic.py +496 -0
- trendscout-1.2.0/tests/test_schemas_mcp.py +64 -0
- trendscout-1.2.0/trendscout/__init__.py +271 -0
- trendscout-1.2.0/trendscout/mcp_server.py +175 -0
- trendscout-1.2.0/trendscout/schemas.py +80 -0
- trendscout-1.2.0/trendscout/scraper.py +55 -0
- trendscout-1.2.0/trendscout/sentiment.py +113 -0
- trendscout-1.2.0/trendscout/sources/__init__.py +1 -0
- trendscout-1.2.0/trendscout/sources/github_trending.py +124 -0
- trendscout-1.2.0/trendscout/sources/hackernews.py +121 -0
- trendscout-1.2.0/trendscout/sources/rss.py +153 -0
- trendscout-1.2.0/trendscout/velocity.py +87 -0
- trendscout-1.2.0/trendscout.egg-info/PKG-INFO +259 -0
- trendscout-1.2.0/trendscout.egg-info/SOURCES.txt +20 -0
- trendscout-1.2.0/trendscout.egg-info/entry_points.txt +2 -0
- {trendscout-0.3.0 → trendscout-1.2.0}/trendscout.egg-info/requires.txt +4 -0
- trendscout-0.3.0/PKG-INFO +0 -68
- trendscout-0.3.0/README.md +0 -40
- trendscout-0.3.0/tests/test_basic.py +0 -56
- trendscout-0.3.0/trendscout/__init__.py +0 -42
- trendscout-0.3.0/trendscout/scraper.py +0 -52
- trendscout-0.3.0/trendscout/sentiment.py +0 -31
- trendscout-0.3.0/trendscout.egg-info/PKG-INFO +0 -68
- trendscout-0.3.0/trendscout.egg-info/SOURCES.txt +0 -11
- {trendscout-0.3.0 → trendscout-1.2.0}/setup.cfg +0 -0
- {trendscout-0.3.0 → trendscout-1.2.0}/trendscout.egg-info/dependency_links.txt +0 -0
- {trendscout-0.3.0 → trendscout-1.2.0}/trendscout.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: trendscout
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Real-time trend intelligence with HackerNews, RSS feeds, trend velocity, and multi-domain sentiment
|
|
5
|
+
Author-email: Teyfik OZ <teyfikoz@yahoo.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/teyfikoz/trendscout
|
|
8
|
+
Project-URL: Repository, https://github.com/teyfikoz/trendscout
|
|
9
|
+
Project-URL: Issues, https://github.com/teyfikoz/trendscout/issues
|
|
10
|
+
Keywords: trends,sentiment,market-analysis,nlp,scraping
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Requires-Dist: beautifulsoup4>=4.12.0
|
|
22
|
+
Requires-Dist: pandas>=2.0.0
|
|
23
|
+
Requires-Dist: requests>=2.31.0
|
|
24
|
+
Requires-Dist: textblob>=0.17.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
27
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
28
|
+
Provides-Extra: mcp
|
|
29
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
30
|
+
Requires-Dist: pydantic>=2.0; extra == "mcp"
|
|
31
|
+
|
|
32
|
+
# TrendScout
|
|
33
|
+
|
|
34
|
+
**Real-time trend intelligence** — HackerNews search, RSS feed parsing, trend velocity scoring, and multi-domain sentiment analysis. No API key required.
|
|
35
|
+
|
|
36
|
+
[](https://pypi.org/project/trendscout/)
|
|
37
|
+
[](https://github.com/teyfikoz/trendscout/actions/workflows/publish.yml)
|
|
38
|
+
[](https://github.com/teyfikoz/trendscout/actions/workflows/ci.yml)
|
|
39
|
+
[](https://www.python.org/)
|
|
40
|
+
[](https://opensource.org/licenses/MIT)
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install trendscout
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from trendscout import TrendScout
|
|
52
|
+
|
|
53
|
+
ts = TrendScout()
|
|
54
|
+
|
|
55
|
+
# Real HackerNews data — no API key needed
|
|
56
|
+
df = ts.get_hackernews_trends("AI agents", limit=10)
|
|
57
|
+
print(df[['title', 'score', 'num_comments']].head())
|
|
58
|
+
|
|
59
|
+
# Sentiment with market signal
|
|
60
|
+
result = ts.analyze_sentiment("GPT-5 crushes every benchmark!", domain="tech")
|
|
61
|
+
print(result)
|
|
62
|
+
|
|
63
|
+
# Trend velocity
|
|
64
|
+
velocity = ts.get_trend_velocity("rust programming language")
|
|
65
|
+
print(velocity)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Features at a Glance
|
|
71
|
+
|
|
72
|
+
| Feature | Description |
|
|
73
|
+
|---------|-------------|
|
|
74
|
+
| **HackerNews API** | Real stories via Algolia — free, no key, always fresh |
|
|
75
|
+
| **RSS/Atom Feeds** | Tech, AI, business, Python presets + custom URLs |
|
|
76
|
+
| **Trend Velocity** | Momentum score 0–1 with status: emerging/peak/stable/declining |
|
|
77
|
+
| **Sentiment Analysis** | TextBlob + domain-aware lexicons (financial, tech, social) |
|
|
78
|
+
| **Multi-topic Analysis** | Compare topics side-by-side in a ranked DataFrame |
|
|
79
|
+
| **DataFrame Batch** | Bulk sentiment analysis on any text DataFrame |
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## HackerNews Trends (Real Data)
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from trendscout import TrendScout
|
|
87
|
+
|
|
88
|
+
ts = TrendScout()
|
|
89
|
+
|
|
90
|
+
# Search by keyword — uses HN Algolia API
|
|
91
|
+
df = ts.get_hackernews_trends("large language models", limit=20)
|
|
92
|
+
print(df[['title', 'score', 'num_comments', 'author']].head(5))
|
|
93
|
+
# title score num_comments author
|
|
94
|
+
# 0 LLMs are now good enough for production use 847 312 pg
|
|
95
|
+
# 1 Show HN: Open-source LLM benchmark suite 412 189 teyfikoz
|
|
96
|
+
# ...
|
|
97
|
+
|
|
98
|
+
# Top stories right now
|
|
99
|
+
from trendscout.sources.hackernews import HackerNewsSource
|
|
100
|
+
hn = HackerNewsSource()
|
|
101
|
+
top = hn.get_top_stories(limit=10)
|
|
102
|
+
for story in top:
|
|
103
|
+
print(f"[{story.score:4d}] {story.title[:70]}")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## RSS / Atom Feed Parsing
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
ts = TrendScout()
|
|
112
|
+
|
|
113
|
+
# Preset categories: tech | ai | business | python | startup
|
|
114
|
+
tech_news = ts.get_rss_trends(category="tech", limit=15)
|
|
115
|
+
ai_news = ts.get_rss_trends(category="ai", limit=10)
|
|
116
|
+
|
|
117
|
+
print(tech_news[['title', 'published', 'feed_name']].head())
|
|
118
|
+
|
|
119
|
+
# Custom feed URLs
|
|
120
|
+
custom = ts.get_rss_trends(
|
|
121
|
+
feeds=[
|
|
122
|
+
"https://feeds.hnrss.org/newest?points=100",
|
|
123
|
+
"https://planetpython.org/rss20.xml",
|
|
124
|
+
],
|
|
125
|
+
limit=20,
|
|
126
|
+
)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Trend Velocity Scoring
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
velocity = ts.get_trend_velocity("quantum computing")
|
|
135
|
+
print(velocity)
|
|
136
|
+
# Trend : quantum computing
|
|
137
|
+
# Velocity: [████████░░░░░░░░░░░░] 0.42
|
|
138
|
+
# Status : PEAK
|
|
139
|
+
# Articles: 12 | Avg engagement: 156
|
|
140
|
+
# → Trending now — maximise exposure before it plateaus
|
|
141
|
+
|
|
142
|
+
# Status meanings:
|
|
143
|
+
# emerging (0.70–1.00) — fast-growing, act now
|
|
144
|
+
# peak (0.40–0.70) — trending, maximise reach
|
|
145
|
+
# stable (0.15–0.40) — evergreen, good for long-form
|
|
146
|
+
# declining (0.00–0.15) — losing momentum, pivot keywords
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Multi-Topic Comparison
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
report = ts.analyze_topics(
|
|
155
|
+
["AI agents", "blockchain", "quantum computing", "WebAssembly", "Rust"],
|
|
156
|
+
source="hackernews",
|
|
157
|
+
)
|
|
158
|
+
print(report.to_string(index=False))
|
|
159
|
+
# topic velocity_score status article_count avg_engagement
|
|
160
|
+
# AI agents 0.87 emerging 24 312.4
|
|
161
|
+
# Rust 0.64 peak 18 198.2
|
|
162
|
+
# quantum computing 0.42 peak 12 156.1
|
|
163
|
+
# blockchain 0.21 stable 8 89.3
|
|
164
|
+
# WebAssembly 0.09 declining 4 42.0
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Sentiment Analysis
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
# General sentiment
|
|
173
|
+
result = ts.analyze_sentiment("The product launch exceeded all expectations.")
|
|
174
|
+
print(result.label) # positive
|
|
175
|
+
print(result.intensity) # strong
|
|
176
|
+
print(result.polarity) # 0.625
|
|
177
|
+
|
|
178
|
+
# Financial domain (detects bullish/bearish signals)
|
|
179
|
+
fin = ts.analyze_sentiment("Revenue surged 40% beating analyst estimates.", domain="financial")
|
|
180
|
+
print(fin.market_signal) # bullish
|
|
181
|
+
print(fin.confidence) # 0.92
|
|
182
|
+
|
|
183
|
+
# Tech news domain
|
|
184
|
+
tech = ts.analyze_sentiment("Critical vulnerability found in popular library.", domain="tech")
|
|
185
|
+
print(tech.market_signal) # bearish
|
|
186
|
+
print(tech.label) # negative
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Batch DataFrame Analysis
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
import pandas as pd
|
|
193
|
+
|
|
194
|
+
headlines = pd.DataFrame({
|
|
195
|
+
'headline': [
|
|
196
|
+
"OpenAI releases new model beating GPT-4",
|
|
197
|
+
"Tech stocks plunge amid regulatory fears",
|
|
198
|
+
"Startup raises $50M Series B for AI platform",
|
|
199
|
+
"Security breach affects millions of users",
|
|
200
|
+
]
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
result = ts.analyze_dataframe(headlines, text_col="headline", domain="financial")
|
|
204
|
+
print(result[['headline', 'sentiment_label', 'market_signal', 'polarity']])
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Direct Source Access
|
|
210
|
+
|
|
211
|
+
```python
|
|
212
|
+
from trendscout.sources.hackernews import HackerNewsSource
|
|
213
|
+
from trendscout.sources.rss import RSSFeedSource
|
|
214
|
+
|
|
215
|
+
# HackerNews
|
|
216
|
+
hn = HackerNewsSource()
|
|
217
|
+
stories = hn.search("python async", limit=5)
|
|
218
|
+
for s in stories:
|
|
219
|
+
print(f"[{s.score}] {s.title}")
|
|
220
|
+
|
|
221
|
+
# RSS
|
|
222
|
+
rss = RSSFeedSource()
|
|
223
|
+
items = rss.fetch("https://feeds.hnrss.org/newest?points=100", limit=5)
|
|
224
|
+
for item in items:
|
|
225
|
+
print(item.title)
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Full Intelligence Pipeline
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
from trendscout import TrendScout
|
|
234
|
+
|
|
235
|
+
ts = TrendScout()
|
|
236
|
+
topics = ["AI agents", "edge computing", "Web3", "open source LLMs"]
|
|
237
|
+
|
|
238
|
+
# 1. Velocity comparison
|
|
239
|
+
report = ts.analyze_topics(topics)
|
|
240
|
+
|
|
241
|
+
# 2. Fetch real articles for the top trend
|
|
242
|
+
top_topic = report.iloc[0]['topic']
|
|
243
|
+
articles = ts.get_hackernews_trends(top_topic, limit=20)
|
|
244
|
+
|
|
245
|
+
# 3. Batch sentiment on the articles
|
|
246
|
+
enriched = ts.analyze_dataframe(articles, text_col="title", domain="tech")
|
|
247
|
+
|
|
248
|
+
# 4. Summary
|
|
249
|
+
bullish_count = (enriched['market_signal'] == 'bullish').sum()
|
|
250
|
+
print(f"Top trend: {top_topic}")
|
|
251
|
+
print(f"Velocity: {report.iloc[0]['velocity_score']:.2f} ({report.iloc[0]['status']})")
|
|
252
|
+
print(f"Positive articles: {bullish_count}/{len(enriched)}")
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## License
|
|
258
|
+
|
|
259
|
+
MIT — [Teyfik Öz](https://github.com/teyfikoz)
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# TrendScout
|
|
2
|
+
|
|
3
|
+
**Real-time trend intelligence** — HackerNews search, RSS feed parsing, trend velocity scoring, and multi-domain sentiment analysis. No API key required.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/trendscout/)
|
|
6
|
+
[](https://github.com/teyfikoz/trendscout/actions/workflows/publish.yml)
|
|
7
|
+
[](https://github.com/teyfikoz/trendscout/actions/workflows/ci.yml)
|
|
8
|
+
[](https://www.python.org/)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install trendscout
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from trendscout import TrendScout
|
|
21
|
+
|
|
22
|
+
ts = TrendScout()
|
|
23
|
+
|
|
24
|
+
# Real HackerNews data — no API key needed
|
|
25
|
+
df = ts.get_hackernews_trends("AI agents", limit=10)
|
|
26
|
+
print(df[['title', 'score', 'num_comments']].head())
|
|
27
|
+
|
|
28
|
+
# Sentiment with market signal
|
|
29
|
+
result = ts.analyze_sentiment("GPT-5 crushes every benchmark!", domain="tech")
|
|
30
|
+
print(result)
|
|
31
|
+
|
|
32
|
+
# Trend velocity
|
|
33
|
+
velocity = ts.get_trend_velocity("rust programming language")
|
|
34
|
+
print(velocity)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Features at a Glance
|
|
40
|
+
|
|
41
|
+
| Feature | Description |
|
|
42
|
+
|---------|-------------|
|
|
43
|
+
| **HackerNews API** | Real stories via Algolia — free, no key, always fresh |
|
|
44
|
+
| **RSS/Atom Feeds** | Tech, AI, business, Python presets + custom URLs |
|
|
45
|
+
| **Trend Velocity** | Momentum score 0–1 with status: emerging/peak/stable/declining |
|
|
46
|
+
| **Sentiment Analysis** | TextBlob + domain-aware lexicons (financial, tech, social) |
|
|
47
|
+
| **Multi-topic Analysis** | Compare topics side-by-side in a ranked DataFrame |
|
|
48
|
+
| **DataFrame Batch** | Bulk sentiment analysis on any text DataFrame |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## HackerNews Trends (Real Data)
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from trendscout import TrendScout
|
|
56
|
+
|
|
57
|
+
ts = TrendScout()
|
|
58
|
+
|
|
59
|
+
# Search by keyword — uses HN Algolia API
|
|
60
|
+
df = ts.get_hackernews_trends("large language models", limit=20)
|
|
61
|
+
print(df[['title', 'score', 'num_comments', 'author']].head(5))
|
|
62
|
+
# title score num_comments author
|
|
63
|
+
# 0 LLMs are now good enough for production use 847 312 pg
|
|
64
|
+
# 1 Show HN: Open-source LLM benchmark suite 412 189 teyfikoz
|
|
65
|
+
# ...
|
|
66
|
+
|
|
67
|
+
# Top stories right now
|
|
68
|
+
from trendscout.sources.hackernews import HackerNewsSource
|
|
69
|
+
hn = HackerNewsSource()
|
|
70
|
+
top = hn.get_top_stories(limit=10)
|
|
71
|
+
for story in top:
|
|
72
|
+
print(f"[{story.score:4d}] {story.title[:70]}")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## RSS / Atom Feed Parsing
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
ts = TrendScout()
|
|
81
|
+
|
|
82
|
+
# Preset categories: tech | ai | business | python | startup
|
|
83
|
+
tech_news = ts.get_rss_trends(category="tech", limit=15)
|
|
84
|
+
ai_news = ts.get_rss_trends(category="ai", limit=10)
|
|
85
|
+
|
|
86
|
+
print(tech_news[['title', 'published', 'feed_name']].head())
|
|
87
|
+
|
|
88
|
+
# Custom feed URLs
|
|
89
|
+
custom = ts.get_rss_trends(
|
|
90
|
+
feeds=[
|
|
91
|
+
"https://feeds.hnrss.org/newest?points=100",
|
|
92
|
+
"https://planetpython.org/rss20.xml",
|
|
93
|
+
],
|
|
94
|
+
limit=20,
|
|
95
|
+
)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Trend Velocity Scoring
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
velocity = ts.get_trend_velocity("quantum computing")
|
|
104
|
+
print(velocity)
|
|
105
|
+
# Trend : quantum computing
|
|
106
|
+
# Velocity: [████████░░░░░░░░░░░░] 0.42
|
|
107
|
+
# Status : PEAK
|
|
108
|
+
# Articles: 12 | Avg engagement: 156
|
|
109
|
+
# → Trending now — maximise exposure before it plateaus
|
|
110
|
+
|
|
111
|
+
# Status meanings:
|
|
112
|
+
# emerging (0.70–1.00) — fast-growing, act now
|
|
113
|
+
# peak (0.40–0.70) — trending, maximise reach
|
|
114
|
+
# stable (0.15–0.40) — evergreen, good for long-form
|
|
115
|
+
# declining (0.00–0.15) — losing momentum, pivot keywords
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Multi-Topic Comparison
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
report = ts.analyze_topics(
|
|
124
|
+
["AI agents", "blockchain", "quantum computing", "WebAssembly", "Rust"],
|
|
125
|
+
source="hackernews",
|
|
126
|
+
)
|
|
127
|
+
print(report.to_string(index=False))
|
|
128
|
+
# topic velocity_score status article_count avg_engagement
|
|
129
|
+
# AI agents 0.87 emerging 24 312.4
|
|
130
|
+
# Rust 0.64 peak 18 198.2
|
|
131
|
+
# quantum computing 0.42 peak 12 156.1
|
|
132
|
+
# blockchain 0.21 stable 8 89.3
|
|
133
|
+
# WebAssembly 0.09 declining 4 42.0
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Sentiment Analysis
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
# General sentiment
|
|
142
|
+
result = ts.analyze_sentiment("The product launch exceeded all expectations.")
|
|
143
|
+
print(result.label) # positive
|
|
144
|
+
print(result.intensity) # strong
|
|
145
|
+
print(result.polarity) # 0.625
|
|
146
|
+
|
|
147
|
+
# Financial domain (detects bullish/bearish signals)
|
|
148
|
+
fin = ts.analyze_sentiment("Revenue surged 40% beating analyst estimates.", domain="financial")
|
|
149
|
+
print(fin.market_signal) # bullish
|
|
150
|
+
print(fin.confidence) # 0.92
|
|
151
|
+
|
|
152
|
+
# Tech news domain
|
|
153
|
+
tech = ts.analyze_sentiment("Critical vulnerability found in popular library.", domain="tech")
|
|
154
|
+
print(tech.market_signal) # bearish
|
|
155
|
+
print(tech.label) # negative
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Batch DataFrame Analysis
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
import pandas as pd
|
|
162
|
+
|
|
163
|
+
headlines = pd.DataFrame({
|
|
164
|
+
'headline': [
|
|
165
|
+
"OpenAI releases new model beating GPT-4",
|
|
166
|
+
"Tech stocks plunge amid regulatory fears",
|
|
167
|
+
"Startup raises $50M Series B for AI platform",
|
|
168
|
+
"Security breach affects millions of users",
|
|
169
|
+
]
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
result = ts.analyze_dataframe(headlines, text_col="headline", domain="financial")
|
|
173
|
+
print(result[['headline', 'sentiment_label', 'market_signal', 'polarity']])
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Direct Source Access
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
from trendscout.sources.hackernews import HackerNewsSource
|
|
182
|
+
from trendscout.sources.rss import RSSFeedSource
|
|
183
|
+
|
|
184
|
+
# HackerNews
|
|
185
|
+
hn = HackerNewsSource()
|
|
186
|
+
stories = hn.search("python async", limit=5)
|
|
187
|
+
for s in stories:
|
|
188
|
+
print(f"[{s.score}] {s.title}")
|
|
189
|
+
|
|
190
|
+
# RSS
|
|
191
|
+
rss = RSSFeedSource()
|
|
192
|
+
items = rss.fetch("https://feeds.hnrss.org/newest?points=100", limit=5)
|
|
193
|
+
for item in items:
|
|
194
|
+
print(item.title)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Full Intelligence Pipeline
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
from trendscout import TrendScout
|
|
203
|
+
|
|
204
|
+
ts = TrendScout()
|
|
205
|
+
topics = ["AI agents", "edge computing", "Web3", "open source LLMs"]
|
|
206
|
+
|
|
207
|
+
# 1. Velocity comparison
|
|
208
|
+
report = ts.analyze_topics(topics)
|
|
209
|
+
|
|
210
|
+
# 2. Fetch real articles for the top trend
|
|
211
|
+
top_topic = report.iloc[0]['topic']
|
|
212
|
+
articles = ts.get_hackernews_trends(top_topic, limit=20)
|
|
213
|
+
|
|
214
|
+
# 3. Batch sentiment on the articles
|
|
215
|
+
enriched = ts.analyze_dataframe(articles, text_col="title", domain="tech")
|
|
216
|
+
|
|
217
|
+
# 4. Summary
|
|
218
|
+
bullish_count = (enriched['market_signal'] == 'bullish').sum()
|
|
219
|
+
print(f"Top trend: {top_topic}")
|
|
220
|
+
print(f"Velocity: {report.iloc[0]['velocity_score']:.2f} ({report.iloc[0]['status']})")
|
|
221
|
+
print(f"Positive articles: {bullish_count}/{len(enriched)}")
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
MIT — [Teyfik Öz](https://github.com/teyfikoz)
|
|
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "trendscout"
|
|
7
|
-
version = "
|
|
8
|
-
description = "
|
|
7
|
+
version = "1.2.0"
|
|
8
|
+
description = "Real-time trend intelligence with HackerNews, RSS feeds, trend velocity, and multi-domain sentiment"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
11
11
|
{ name = "Teyfik OZ", email = "teyfikoz@yahoo.com" }
|
|
12
12
|
]
|
|
13
13
|
license = {text = "MIT"}
|
|
14
14
|
classifiers = [
|
|
15
|
-
"Development Status ::
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
16
|
"Intended Audience :: Developers",
|
|
17
17
|
"Programming Language :: Python :: 3",
|
|
18
18
|
"Programming Language :: Python :: 3.10",
|
|
@@ -35,6 +35,13 @@ dev = [
|
|
|
35
35
|
"pytest>=7.0",
|
|
36
36
|
"ruff>=0.1.0",
|
|
37
37
|
]
|
|
38
|
+
mcp = [
|
|
39
|
+
"mcp>=1.0",
|
|
40
|
+
"pydantic>=2.0",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.scripts]
|
|
44
|
+
trendscout-mcp = "trendscout.mcp_server:main"
|
|
38
45
|
|
|
39
46
|
[project.urls]
|
|
40
47
|
Homepage = "https://github.com/teyfikoz/trendscout"
|