π¬ Transform Reddit content into engaging videos automatically!
A powerful Python automation tool that creates professional video content from Reddit posts and comments. Perfect for content creators, this bot scrapes popular posts from r/AskReddit, converts text to speech, captures high-quality screenshots, and compiles everything into polished videos ready for YouTube, TikTok, or other social media platforms.
- Scrapes Reddit: Fetches the hottest posts from r/AskReddit
- Interactive Selection: Let you choose from 20 trending posts
- Smart Screenshots: Automatically captures Reddit posts and comments
- Text-to-Speech: Converts all text to natural-sounding audio
- Video Magic: Combines everything into a professional video with transitions
- Ready to Upload: Outputs MP4 files optimized for social media
- Automated Reddit Scraping: Fetches hot posts from r/AskReddit subreddit
- Interactive Post Selection: Choose from the top 20 trending posts
- Screenshot Automation: Uses Selenium WebDriver to capture Reddit post and comment screenshots
- Text-to-Speech Generation: Converts post titles and comments to audio using Google Text-to-Speech (gTTS)
- Video Compilation: Creates professional-looking videos with transitions and background images
- Content Filtering: Automatically removes links from comments for cleaner audio
- Customizable Output: Choose how many comments to include in your video
- Multiple Execution Modes:
- Full mode: Complete scraping and video creation
- Video-only mode: Create videos from existing screenshots and audio
- Fast mode: Quick video generation for testing purposes
- Smart Image Processing: Automatically scales and centers Reddit screenshots on custom backgrounds
- Professional Transitions: Includes transition effects between video segments
redditbot/
βββ main.py # Main application script
βββ requirements.txt # Python dependencies
βββ init.bat # Windows initialization script
βββ README.md # Project documentation
βββ .env # Environment variables (you need to create this)
βββ .gitignore # Git ignore rules
βββ __pycache__/ # Python cache files
βββ output/ # Generated content
β βββ audio/ # Generated audio files (MP3s)
β β βββ title.mp3 # Title audio
β β βββ file1.mp3 # Comment audio files
β β βββ ... # Additional comment files
β β βββ final_audio.mp3 # Combined final audio
β βββ images/ # Screenshot images (PNG files)
β β βββ Title.png # Post title screenshot
β β βββ image1.png # Comment screenshots
β β βββ ... # Additional image files
β βββ video/ # Final video output (MP4 files)
β βββ reddit_video.mp4 # Generated video
βββ utils/
βββ assets/ # Background images and transition assets
β βββ space.png # Background image for videos
β βββ transition.jpg # Transition image
β βββ transition audio.mp3 # Transition sound
β βββ black background.jpg # Alternative background
βββ example/ # Example files and samples
βββ tests/ # Test files and scripts
βββ test.py # Test script
βββ test.mp3 # Test audio file
- Python 3.7 or higher
- Chrome browser installed
- Reddit account
- Reddit API credentials
-
Clone the repository:
git clone <repository-url> cd redditbot
-
Run the initialization script (Windows):
init.bat
Or install manually:
pip install -r requirements.txt
-
Set up Reddit API credentials:
- Go to Reddit Apps
- Click "Create App" or "Create Another App"
- Choose "script" as the app type
- Note down your
client_idandclient_secret
-
Configure environment variables: Create a
.envfile in the root directory:CLIENT_ID=your_client_id_here SECRET_KEY=your_client_secret_here USERNAME=your_reddit_username PASSWORD=your_reddit_password
The bot supports three different execution modes:
Complete Reddit scraping and video creation process:
python main.py-
Select a post:
- The bot will display the top 20 hot posts from r/AskReddit
- Type the exact title of the post you want to create a video from
-
Choose comment count:
- Enter the number of comments you want to include in your video
-
Wait for processing:
- The bot will automatically log into Reddit, take screenshots, generate audio, and create the final video
-
Find your video:
- The final video will be saved as
output/video/reddit_video.mp4
- The final video will be saved as
Create a video from existing screenshots and audio files (useful for re-rendering):
python main.py --video-onlyThis mode will:
- Skip Reddit scraping and screenshot capture
- Use existing files in
output/images/andoutput/audio/ - Generate a new video with current settings
Quick video generation for testing purposes:
python main.py --fastThis mode will:
- Use existing screenshots and audio files
- Create video with optimized settings for faster processing
- Perfect for testing changes without full processing time
All dependencies are listed in requirements.txt and can be installed with pip install -r requirements.txt:
- selenium: Web browser automation for taking Reddit screenshots
- praw: Python Reddit API Wrapper for accessing Reddit posts and comments
- Pillow (PIL): Image processing and manipulation for screenshot editing
- pyautogui: GUI automation for scrolling and clicking during screenshot capture
- gtts: Google Text-to-Speech for converting text to audio
- moviepy: Video editing and compilation for creating the final video
- python-dotenv: Environment variable management for secure credential storage
- Python 3.7+: Required for all dependencies
- Chrome Browser: Required for Selenium WebDriver
- Internet Connection: Required for Reddit API access and Google Text-to-Speech
| Variable | Description | Required |
|---|---|---|
CLIENT_ID |
Reddit app client ID | Yes |
SECRET_KEY |
Reddit app secret key | Yes |
USERNAME |
Your Reddit username | Yes |
PASSWORD |
Your Reddit password | Yes |
- Subreddit: Change
subreddit = reddit.subreddit('askreddit')inmain.pyto target different subreddits - Post Limit: Modify
hot = subreddit.hot(limit=20)to fetch more/fewer posts - Background Images: Replace images in
utils/assets/to customize video appearance - Video Quality: Adjust FPS and resolution in the
createVideo()function
The bot generates:
- Audio Files: Individual MP3 files for each post title and comment
- Image Files: PNG screenshots of Reddit posts and comments
- Final Video: MP4 file combining all elements with transitions
-
Environment Variables Not Found:
- Ensure
.envfile exists in the root directory - Check for typos in variable names (case-sensitive)
- Verify all four variables are present:
CLIENT_ID,SECRET_KEY,USERNAME,PASSWORD
- Ensure
-
Chrome Driver Issues:
- Make sure Chrome browser is installed and up to date
- Selenium automatically downloads ChromeDriver, but ensure Chrome is in your PATH
- Try running Chrome manually to verify it works
-
Login Failures:
- Verify Reddit credentials are correct (username/password)
- Important: 2FA (Two-Factor Authentication) is NOT supported - disable it temporarily
- Check if your account is suspended or has restrictions
-
Screenshot Problems:
- Ensure your screen resolution is at least 1920x1080
- Try running with Chrome window maximized
- Check if Reddit's layout has changed (may require code updates)
- Make sure you're not running other programs that interfere with browser automation
-
Audio Generation Issues:
- Ensure stable internet connection for Google Text-to-Speech
- Check if comments contain special characters that might cause issues
- Verify
output/audio/directory exists
-
Video Creation Problems:
- Ensure
output/images/contains the required screenshot files - Check available disk space for video processing
- Verify all audio files were generated successfully
- Ensure
-
Permission Errors:
- Run terminal/command prompt as administrator (Windows)
- Check file permissions in the output directories
- Ensure antivirus isn't blocking file creation
| Error Message | Solution |
|---|---|
"Missing required environment variables" |
Create and configure your .env file with all four variables |
"No comment images found!" |
Run full mode first to generate screenshots before using --video-only |
Selenium WebDriver errors |
Update Chrome browser, check internet connection, or restart the script |
PRAW authentication errors |
Verify Reddit API credentials and disable 2FA |
"Permission denied" |
Run as administrator or check file permissions |
MoviePy errors during video creation |
Check disk space and ensure all required files exist |
gTTS errors |
Check internet connection and try again |
- Faster Processing: Use
--fastmode for testing - Reduce Video Size: Use fewer comments (5-10 recommended)
- Better Quality: Ensure high-resolution screenshots by maximizing browser window
- Stable Results: Wait a few seconds between runs to avoid rate limiting
This project is for educational purposes. Please respect Reddit's Terms of Service and API guidelines when using this bot.
The bot generates videos with:
- Professional Layout: Reddit screenshots centered on custom backgrounds
- Smooth Transitions: Seamless transitions between post and comments
- Clear Audio: High-quality text-to-speech narration
- Optimized Format: Ready-to-upload MP4 files
# Create a full video (scraping + video creation)
python main.py
# Re-render video from existing files
python main.py --video-only
# Quick test render
python main.py --fastContributions are welcome! Here's how you can help:
- π Report bugs by opening issues
- π‘ Suggest new features or improvements
- π§ Submit pull requests with enhancements
- π Improve documentation
- Educational Use: This bot is intended for educational and personal use only
- Reddit ToS: Always respect Reddit's Terms of Service, robots.txt, and API rate limits
- Content Ethics: Be mindful of fair use policies when creating videos from Reddit content
- Attribution: Consider crediting original Reddit users in your videos
- Rate Limiting: Don't abuse the bot - use reasonable delays between requests
- v1.0: Basic Reddit scraping and video creation
- v1.1: Added command-line modes (--video-only, --fast)
- v1.2: Improved image processing and error handling
- Current: Enhanced documentation and troubleshooting