trendscout 0.1.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-0.1.0/PKG-INFO +12 -0
- trendscout-0.1.0/README.md +19 -0
- trendscout-0.1.0/setup.cfg +4 -0
- trendscout-0.1.0/setup.py +16 -0
- trendscout-0.1.0/src/trendscout/__init__.py +8 -0
- trendscout-0.1.0/src/trendscout/scraper.py +52 -0
- trendscout-0.1.0/src/trendscout/sentiment.py +31 -0
- trendscout-0.1.0/src/trendscout.egg-info/PKG-INFO +12 -0
- trendscout-0.1.0/src/trendscout.egg-info/SOURCES.txt +10 -0
- trendscout-0.1.0/src/trendscout.egg-info/dependency_links.txt +1 -0
- trendscout-0.1.0/src/trendscout.egg-info/requires.txt +4 -0
- trendscout-0.1.0/src/trendscout.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: trendscout
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI-Powered Market Trend Analysis & Sentinel
|
|
5
|
+
Requires-Python: >=3.8
|
|
6
|
+
Requires-Dist: requests
|
|
7
|
+
Requires-Dist: pandas
|
|
8
|
+
Requires-Dist: beautifulsoup4
|
|
9
|
+
Requires-Dist: textblob
|
|
10
|
+
Dynamic: requires-dist
|
|
11
|
+
Dynamic: requires-python
|
|
12
|
+
Dynamic: summary
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# TrendScout: AI-Powered Market Trend Analysis
|
|
2
|
+
|
|
3
|
+
TrendScout helps you stay ahead of the curve by scraping and analyzing market trends.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
```bash
|
|
7
|
+
pip install trendscout
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
- **Scraper**: Fetch trends from multiple sources.
|
|
12
|
+
- **Sentiment Analysis**: Understand the market mood (Powered by TextBlob).
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
```python
|
|
16
|
+
from trendscout import TrendScraper, SentimentAnalyzer
|
|
17
|
+
scraper = TrendScraper()
|
|
18
|
+
df = scraper.get_trends("Cryptocurrency")
|
|
19
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="trendscout",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
description="AI-Powered Market Trend Analysis & Sentinel",
|
|
7
|
+
package_dir={"": "src"},
|
|
8
|
+
packages=find_packages(where="src"),
|
|
9
|
+
install_requires=[
|
|
10
|
+
"requests",
|
|
11
|
+
"pandas",
|
|
12
|
+
"beautifulsoup4",
|
|
13
|
+
"textblob", # Simple sentiment
|
|
14
|
+
],
|
|
15
|
+
python_requires=">=3.8",
|
|
16
|
+
)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import pandas as pd
|
|
3
|
+
from typing import List, Dict
|
|
4
|
+
import random
|
|
5
|
+
|
|
6
|
+
class TrendScraper:
|
|
7
|
+
"""
|
|
8
|
+
Scrapes trending topics from various sources.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(self, use_mock: bool = True):
|
|
12
|
+
self.use_mock = use_mock
|
|
13
|
+
|
|
14
|
+
def get_trends(self, topic: str = "technology") -> pd.DataFrame:
|
|
15
|
+
"""
|
|
16
|
+
Get trending articles/posts about a topic.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
topic: Keyword to search
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
DataFrame with 'title', 'source', 'url', 'timestamp'
|
|
23
|
+
"""
|
|
24
|
+
if self.use_mock:
|
|
25
|
+
return self._mock_trends(topic)
|
|
26
|
+
|
|
27
|
+
# TODO: Implement real scraping logic here
|
|
28
|
+
# For now, fallback to mock
|
|
29
|
+
return self._mock_trends(topic)
|
|
30
|
+
|
|
31
|
+
def _mock_trends(self, topic: str) -> pd.DataFrame:
|
|
32
|
+
"""Generate dummy trend data."""
|
|
33
|
+
titles = [
|
|
34
|
+
f"Why {topic} is booming in 2026",
|
|
35
|
+
f"Top 10 {topic} trends to watch",
|
|
36
|
+
f"The future of {topic} explained",
|
|
37
|
+
f"Investors are flocking to {topic}",
|
|
38
|
+
f"{topic} crash imminent? Experts warn.",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
sources = ["TechCrunch", "Bloomberg", "Reuters", "The Verge", "Wired"]
|
|
42
|
+
|
|
43
|
+
data = []
|
|
44
|
+
for t in titles:
|
|
45
|
+
data.append({
|
|
46
|
+
"title": t,
|
|
47
|
+
"source": random.choice(sources),
|
|
48
|
+
"url": f"https://example.com/{random.randint(1000,9999)}",
|
|
49
|
+
"timestamp": pd.Timestamp.now()
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
return pd.DataFrame(data)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from textblob import TextBlob
|
|
2
|
+
import pandas as pd
|
|
3
|
+
|
|
4
|
+
class SentimentAnalyzer:
|
|
5
|
+
"""
|
|
6
|
+
Analyzes sentiment of text data.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def analyze(text: str) -> dict:
|
|
11
|
+
"""Get sentiment score."""
|
|
12
|
+
blob = TextBlob(text)
|
|
13
|
+
return {
|
|
14
|
+
"polarity": blob.sentiment.polarity, # -1 to 1
|
|
15
|
+
"subjectivity": blob.sentiment.subjectivity # 0 to 1
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def analyze_dataframe(self, df: pd.DataFrame, text_col: str) -> pd.DataFrame:
|
|
19
|
+
"""Add sentiment columns to dataframe."""
|
|
20
|
+
df = df.copy()
|
|
21
|
+
df['sentiment'] = df[text_col].apply(lambda x: self.analyze(x)['polarity'])
|
|
22
|
+
df['subjectivity'] = df[text_col].apply(lambda x: self.analyze(x)['subjectivity'])
|
|
23
|
+
|
|
24
|
+
# Classify
|
|
25
|
+
def classify(score):
|
|
26
|
+
if score > 0.1: return "Positive"
|
|
27
|
+
if score < -0.1: return "Negative"
|
|
28
|
+
return "Neutral"
|
|
29
|
+
|
|
30
|
+
df['sentiment_label'] = df['sentiment'].apply(classify)
|
|
31
|
+
return df
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: trendscout
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI-Powered Market Trend Analysis & Sentinel
|
|
5
|
+
Requires-Python: >=3.8
|
|
6
|
+
Requires-Dist: requests
|
|
7
|
+
Requires-Dist: pandas
|
|
8
|
+
Requires-Dist: beautifulsoup4
|
|
9
|
+
Requires-Dist: textblob
|
|
10
|
+
Dynamic: requires-dist
|
|
11
|
+
Dynamic: requires-python
|
|
12
|
+
Dynamic: summary
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
src/trendscout/__init__.py
|
|
4
|
+
src/trendscout/scraper.py
|
|
5
|
+
src/trendscout/sentiment.py
|
|
6
|
+
src/trendscout.egg-info/PKG-INFO
|
|
7
|
+
src/trendscout.egg-info/SOURCES.txt
|
|
8
|
+
src/trendscout.egg-info/dependency_links.txt
|
|
9
|
+
src/trendscout.egg-info/requires.txt
|
|
10
|
+
src/trendscout.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
trendscout
|