Python script to fetch trending AI tweets, analyze them with Claude, and get Google keyword metrics via DataForSEO.
# Install dependencies
pip install -r requirements.txt
# Create .env file from template
cp .env.example .env
# Edit .env and add your API credentials:
# - TWITTER_API_KEY
# - TWITTER_USER_ID
# - CLAUDE_API_KEY
# - DATAFORSEO_LOGIN (get from dataforseo.com)
# - DATAFORSEO_PASSWORD
# Make script executable (optional)
chmod +x main.py.env file to git! It's already in .gitignore.
# Basic usage (defaults: keyword="AI", likes=100)
python3 main.py
# Custom keyword
python3 main.py --keyword "machine learning"
# Custom minimum likes
python3 main.py --likes 50
# Combine both
python3 main.py --keyword "ChatGPT" --likes 200
# Show help
python3 main.py --help--keyword- Search keyword or term (default: "AI")--likes- Minimum number of likes required (default: 100)
- Fetches trending tweets about AI, machine learning, LLMs
- Analyzes with Claude AI to extract:
- Main topics/themes
- Emerging trends
- Key technologies
- SEO keyword recommendations
- Extracts keywords from tweets and Claude's analysis
- Analyzes with DataForSEO to get Google metrics:
- Search volume
- Competition level
- Cost-per-click (CPC)
- Keyword difficulty
- Identifies best SEO opportunities (high volume, low competition)
- Saves comprehensive JSON report
Creates a timestamped JSON file like ai_trends_analysis_2025-10-01_14-30-45.json with:
- Top trending tweets ranked by engagement
- Claude's AI insights
- SEO keyword analysis with search volumes
- Best keyword opportunities
- Hashtag analysis
- Engagement metrics
Edit the script to change:
- Search query
- Number of tweets (max_results)
- Tweet filters (min likes, verified only, etc.)
- Keyword analysis depth
- Location/language for keyword data
- Sign up at https://dataforseo.com/
- Get your credentials from the dashboard
- Add them to your
.envfile:DATAFORSEO_LOGIN=your_email@example.com DATAFORSEO_PASSWORD=your_api_password
Note: Script works without DataForSEO (will skip keyword analysis), but you'll get better insights with it.
All sensitive credentials are stored in .env file:
TWITTER_API_KEY- Your Twitter API keyTWITTER_USER_ID- Your Twitter user IDCLAUDE_API_KEY- Your Anthropic Claude API keyDATAFORSEO_LOGIN- Your DataForSEO emailDATAFORSEO_PASSWORD- Your DataForSEO password
See .env.example for the template.