π¦ Transform Twitter profiles into engaging AI-powered critique podcasts!
A Python application that fetches recent tweets from any Twitter profile and generates an entertaining podcast featuring four AI panelists who analyze, critique, and rate the user's Twitter presence with distinct expert perspectives.
- π¦ Twitter API Integration - Fetches recent tweets from any public Twitter profile
- π€ Multi-Panelist AI Analysis - Four distinct AI experts with unique perspectives:
- Alex Rivera - Social Media Strategist (analytics & growth focused)
- Dr. Maya Chen - Digital Communications Expert (academic & thoughtful)
- Jordan Blake - Content Creator (creative & trend-focused)
- Sam Martinez - Brand Consultant (business & reputation focused)
- ποΈ Natural Podcast Format - Generates conversational critique with ratings and suggestions
- π Text-to-Speech Conversion - Creates high-quality audio podcasts
- π Engagement Analysis - Analyzes likes, retweets, replies, and content patterns
- πΎ File Management - Saves both scripts and audio files with timestamps
- π΅ Instant Playback - Plays generated podcasts automatically
Your generated critique podcast will include:
- Host Introduction - Sets up the episode and introduces panelists
- Profile Overview - User stats, bio, and recent activity summary
- Tweet-by-Tweet Analysis - Detailed discussion of top recent tweets
- Multi-Perspective Critique - Each panelist offers their unique viewpoint
- Numerical Ratings - Scored evaluations on different criteria
- Constructive Suggestions - Practical advice for improvement
- Final Thoughts - Wrap-up with key takeaways
- Python 3.7+ - Download here
- OpenAI API Key - Get yours here
- Twitter Bearer Token - Get from Twitter Developer Portal
-
Clone the repository
git clone https://github.com/yourusername/twitter-critique-podcast.git cd twitter-critique-podcast -
Install dependencies
pip install -r requirements.txt
-
Set up your API keys
Option 1 - Environment Variables:
export OPENAI_API_KEY='your-openai-api-key-here' export TWITTER_BEARER_TOKEN='your-twitter-bearer-token-here'
Option 2 - .env file:
OPENAI_API_KEY=your-openai-api-key-here TWITTER_BEARER_TOKEN=your-twitter-bearer-token-here
- Apply for a Twitter Developer account at developer.twitter.com
- Create a new project/app in the Developer Portal
- Generate your Bearer Token from the "Keys and tokens" section
- No additional permissions needed - the app only reads public tweets
Run the script and follow the prompts:
python3 twitter_critique_podcast.pyExample interaction:
ποΈ Twitter Critique Podcast Generator
========================================
Enter Twitter username (without @): elonmusk
Number of recent tweets to analyze (default 10): 5
π± Fetching recent tweets from @elonmusk...
β
Found 5 tweets from Elon Musk (150,234,567 followers)
π€ Generating podcast critique script...
π Script saved to: twitter_critique_elonmusk_20240128_143022.txt
ποΈ Converting to audio...
Audio saved to: twitter_critique_elonmusk_20240128_143022.mp3
π§ Playing podcast... Press Enter to stop.
Generated files are saved with timestamps:
twitter_critique_[username]_YYYYMMDD_HHMMSS.txt- Full podcast script with speaker labelstwitter_critique_[username]_YYYYMMDD_HHMMSS.mp3- High-quality audio podcast file
- Focus: Engagement metrics, audience growth, posting strategy
- Style: Data-driven analysis with practical insights
- Ratings: Engagement rate, growth potential, timing strategy
- Focus: Communication effectiveness, message clarity, audience connection
- Style: Academic perspective with research-backed observations
- Ratings: Message clarity, communication impact, authenticity
- Focus: Entertainment value, viral potential, creative content
- Style: Energetic and trend-focused commentary
- Ratings: Creativity, entertainment factor, trend awareness
- Focus: Brand reputation, business impact, risk assessment
- Style: Business-minded with reputation considerations
- Ratings: Brand consistency, professional image, business value
| Package | Purpose | Version |
|---|---|---|
openai |
AI script generation | >=1.0.0 |
requests |
HTTP requests for Twitter API | >=2.31.0 |
gTTS |
Google Text-to-Speech | >=2.4.0 |
pygame |
Audio playback | >=2.5.0 |
python-dotenv |
Environment variable management | >=1.0.0 |
- π¦ Twitter API v2 - Tweet fetching and user data
- Recent tweets endpoint
- User lookup by username
- Public metrics (likes, retweets, replies)
- π€ OpenAI GPT-4 - Multi-panelist script generation
- π Google Text-to-Speech - Audio conversion
- Engagement: Likes, retweets, replies per tweet
- Content: Tweet length, topics, sentiment
- Performance: Average engagement, top performing tweets
- Timing: Posting patterns and frequency
- Content Quality: Clarity, value, entertainment
- Engagement Strategy: Audience interaction, call-to-actions
- Brand Consistency: Voice, messaging, professional image
- Growth Potential: Viral capability, audience expansion
- Technical Execution: Hashtag usage, multimedia, formatting
Edit the panelists dictionary in the main class:
self.panelists = {
"alex": {
"name": "Your Panelist Name",
"role": "Their Expertise Area",
"personality": "Their analysis style and focus",
"voice_style": "How they speak"
}
}Modify the generate_podcast_script() method to:
- Change critique criteria
- Adjust script length (currently 800-1000 words)
- Modify conversation style
- Add/remove analysis categories
Edit text_to_speech_multispeaker() to:
- Use different TTS voices
- Adjust speech speed
- Change voice mapping per panelist
- Add audio effects or music
Process multiple Twitter accounts:
usernames = ['user1', 'user2', 'user3']
for username in usernames:
generator.generate_critique_podcast(username, tweet_count=15)Analyze more tweets for deeper insights:
# Analyze up to 100 recent tweets
generator.generate_critique_podcast('username', tweet_count=50)Implement specialized rating criteria for different industries or niches.
- Free Tier: 500,000 tweets per month
- Rate Limits: 300 requests per 15-minute window
- Best Practice: Don't exceed 10-20 requests per minute
- GPT-4: ~$0.03-0.06 per podcast (varies by length)
- Estimate: 1000-1500 tokens per critique
- Optimization: Use GPT-3.5-turbo for cost savings
We welcome contributions! Areas for enhancement:
- π Multi-voice TTS - Different voices for each panelist
- π΅ Audio Production - Background music, professional mixing
- π Advanced Analytics - Sentiment analysis, topic modeling
- π Web Interface - User-friendly web app
- π± Mobile App - Native mobile application
- π€ More Platforms - Instagram, LinkedIn, TikTok analysis
This project is licensed under the MIT License - see the LICENSE file for details.
- Public Data Only: Only analyzes publicly available tweets
- Fair Use: Critiques are transformative commentary
- No Personal Attacks: Focuses on content, not personal characteristics
- Educational Purpose: Designed for constructive feedback
- Respect Privacy: Never stores or shares personal data
- Twitter API for providing access to tweet data
- OpenAI for GPT-4 language model
- gTTS for text-to-speech conversion
- The original Weather Podcast Generator project for inspiration
Common Issues:
Twitter API Access:
- Ensure your Bearer Token is valid and has read permissions
- Check rate limits if requests are failing
- Verify the username exists and account is public
Audio Issues:
- Ensure system has audio output capabilities
- Try installing pygame separately:
pip install pygame - Check file permissions for audio file creation
Script Generation:
- Verify OpenAI API key is valid and has credits
- Try reducing tweet count if hitting token limits
- Check internet connectivity for API calls
β If this project helped you analyze Twitter content, please give it a star! β
Made with β€οΈ for social media enthusiasts and podcast lovers