Skip to content

Mugeshgithub/deep-intelligence

Repository files navigation

CognivexAI · Deep Intelligence

Media vs Ground Reality — Compares what mainstream media reports against what real people are saying across YouTube, Telegram, Twitter/X, and Google Trends.

Analyzes Tamil Nadu politics by default, but supports India national, US, UK, France, and global topics.


How It Works

  1. You enter a topic (e.g. "DMK", "AIADMK", "2026 Tamil Nadu election")
  2. The app fetches YouTube comments, Telegram channel posts, tweets, and Google Trends data
  3. Claude (Anthropic) fuses all sources and returns a structured Gap Score
Score Meaning
Media Score What mainstream media is saying (0–100)
People Score What real people are saying (0–100)
Gap Score Divergence between the two (0–100)
Verdict MAJOR GAP / MODERATE GAP / ALIGNED / REVERSE GAP

Tech Stack

Layer Technology
Frontend Plain HTML/CSS/JS (no framework)
Backend Python · Flask
AI Analysis Claude claude-sonnet-4-5 via Anthropic API
Social Data YouTube Data API v3
Messaging Telegram via Telethon
Trends Google Trends via pytrends
Twitter Nitter public instances (no API key needed)

Prerequisites


Setup

1. Clone the repo

git clone https://github.com/Mugeshgithub/deep-intelligence.git
cd deep-intelligence

2. Install dependencies

pip install -r requirements.txt

3. Create your .env file

Create a .env file in the project root:

TELEGRAM_API_ID=your_api_id
TELEGRAM_API_HASH=your_api_hash
TELEGRAM_SESSION=          # leave blank for now — filled by setup_telegram.py

Get your TELEGRAM_API_ID and TELEGRAM_API_HASH from my.telegram.org → API Development Tools.

4. Authenticate Telegram (one-time)

python3 setup_telegram.py +919XXXXXXXXX

When prompted, Telegram sends an OTP to your app. Write the code to a temp file:

echo "12345" > .tg_code

If you have 2FA enabled, also write your password:

echo "yourpassword" > .tg_pwd

On success, TELEGRAM_SESSION is automatically saved to your .env.

5. Configure API keys in the frontend

Open deep-intelligence.html and set your keys at the top of the <script> block:

const ANTHROPIC_API_KEY = 'sk-ant-...';
const YOUTUBE_API_KEY   = 'AIza...';

6. Start the backend server

python3 server.py

Server starts at http://localhost:5001

7. Open the app

Visit http://localhost:5001 in your browser.


API Endpoints

Endpoint Params Description
GET /api/telegram topic, region Fetch posts from Telegram media/party channels
GET /api/trends topic, geo, compare Google Trends interest over time
GET /api/twitter topic, lang, limit Tweets scraped via Nitter
GET /api/status Telegram config status and loaded regions

Supported regions

Code Region
IN-TN Tamil Nadu (default)
IN India National
US United States
UK United Kingdom
FR France
GLOBAL Global fallback

Known Limitations

  • YouTube comments — Many Tamil political channels disable comments. The app falls back to video titles as signal.
  • Twitter/X — Uses free Nitter scrapers which may go offline. No official API key needed.
  • YouTube quota — Free tier is 10,000 units/day on Google Cloud.
  • Tamil NLP — Claude translates Tamil/Tanglish comments but is not a specialized Tamil NLP model.
  • WhatsApp — Cannot be accessed programmatically (private platform).

Project Structure

deep-intelligence/
├── server.py                    # Flask backend (port 5001)
├── deep-intelligence.html       # Main app UI
├── cognivex-dashboard.html      # Dashboard view
├── ground-reality-FINAL (1).html
├── setup_telegram.py            # Telegram one-time auth
├── requirements.txt
├── PROMPTS.md                   # Claude prompt documentation
└── .env                         # Your credentials (never commit this)

Built by

CognivexAI · Ground Reality Intelligence

About

CognivexAI · Media vs Ground Reality Intelligence — YouTube, Telegram, Twitter & Google Trends analysis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors