Hate speech intelligence platform that monitors Telegram channels, detects spikes in toxicity, and delivers actionable intelligence.
cd hatewatch
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Copy environment template
cp .env.example .envEdit .env with your credentials:
- Telegram API: Get from https://my.telegram.org
- Perspective API: Get from Google Cloud Console
Edit scraper/channels.json:
{
"channels": [
{
"username": "your_channel_username",
"country": "Country",
"language": "en",
"category": "political"
}
]
}python -c "import asyncio; from database.connection import init_db; asyncio.run(init_db())"# Terminal 1: Scraper
python scripts/run_scraper.py --continuous
# Terminal 2: Processor
python scripts/run_processor.py --continuous
# Terminal 3: API Server
uvicorn api.main:app --reload --port 8000
# Terminal 4: Dashboard
cd dashboard
npm install
npm startTelegram Scraper → Processing (Perspective API) → PostgreSQL/SQLite
↓
FastAPI → React Dashboard
| Endpoint | Description |
|---|---|
GET /api/stats |
Summary statistics |
GET /api/alerts |
Active spike alerts |
GET /api/alerts/{id} |
Alert details with posts |
GET /api/timeline |
Toxicity over time |
GET /api/posts |
Browse posts |
GET /api/export/{id} |
Export alert as CSV |
| Script | Purpose |
|---|---|
run_scraper.py |
Fetch messages from Telegram |
run_processor.py |
Score posts with Perspective API |
run_spike_detector.py |
Detect toxicity spikes |
seed_channels.py |
Add channels from JSON |
backfill.py |
Fetch historical data |
- Never commit
.envor.sessionfiles - Keep Telegram session file secure
- Consider IP restrictions on database