🎭 Your Personal Meme Delivery Service
A Python application that scrapes memes from Reddit and sends them via Telegram. This tool automatically collects memes from specified subreddits and forwards them to your Telegram channel or chat.
- Scrapes memes from multiple subreddits
- Sends memes via Telegram bot
- Configurable scheduling
- Automatic duplicate detection
- Logging system for monitoring
- E-ink display support (Raspberry Pi)
- Cross-platform support (Windows, Linux, Raspberry Pi)
- Python 3.8 or higher
- pip (Python package manager)
- Reddit API credentials
- Telegram Bot Token
Linux/Raspberry Pi:
git clone https://github.com/yourusername/reddit_meme_scraper.git
cd reddit_meme_scraper
chmod +x install.sh
./install.shWindows:
git clone https://github.com/yourusername/reddit_meme_scraper.git
cd reddit_meme_scraper
install.batThe installer will:
- ✅ Detect your platform automatically
- ✅ Install dependencies (venv for Linux, system-wide for Raspberry Pi)
- ✅ Set up display support (Raspberry Pi only)
- ✅ Run interactive setup for API credentials
- Clone and Run Installer
git clone https://github.com/yourusername/reddit_meme_scraper.git cd reddit_meme_scraper install.bat
🍓 Raspberry Pi uses system-wide installation (no venv) for simplicity:
-
Clone and Install
git clone https://github.com/yourusername/reddit_meme_scraper.git cd reddit_meme_scraper chmod +x install.sh ./install.sh -
Enable as Service
sudo cp reddit-meme-scraper.service /etc/systemd/system/ sudo sed -i "s|/home/pi/|$HOME/|g" /etc/systemd/system/reddit-meme-scraper.service sudo sed -i "s|User=pi|User=$USER|g" /etc/systemd/system/reddit-meme-scraper.service sudo systemctl enable reddit-meme-scraper sudo systemctl start reddit-meme-scraper
- Install with Virtual Environment
git clone https://github.com/yourusername/reddit_meme_scraper.git cd reddit_meme_scraper chmod +x install.sh ./install.sh
If you have an existing venv-based installation on Raspberry Pi:
cd reddit_meme_scraper
chmod +x migrate_to_system.sh
./migrate_to_system.shThis will migrate your installation to system-wide for better performance and reliability.
-
Reddit API Setup
- Go to Reddit Apps
- Click "Create App" or "Create Another App"
- Fill in the required information
- Note down the client ID and client secret
-
Telegram Bot Setup
- Message @BotFather on Telegram
- Create a new bot using
/newbot - Note down the bot token
- Get your chat ID by messaging @userinfobot
-
Configure
config.json{ "subreddits": ["memes", "dankmemes"], "schedule": { "interval_hours": 1 }, "telegram": { "max_memes_per_batch": 5 } }
-
Run the Application
.\venv\Scripts\python main.py
-
Run as Windows Service (Optional)
- Install NSSM (Non-Sucking Service Manager)
- Create a service:
nssm install RedditMemeScraper "C:\path\to\venv\Scripts\python.exe" "C:\path\to\main.py" nssm start RedditMemeScraper
-
Run the Application
source venv/bin/activate python3 main.py -
Run as Systemd Service (Recommended)
sudo nano /etc/systemd/system/reddit-meme-scraper.service
Add the following content:
[Unit] Description=Reddit Meme Scraper Service After=network.target [Service] Type=simple User=<your-username> WorkingDirectory=/path/to/reddit_meme_scraper Environment=PATH=/path/to/reddit_meme_scraper/venv/bin ExecStart=/path/to/reddit_meme_scraper/venv/bin/python main.py Restart=always RestartSec=10 [Install] WantedBy=multi-user.target
Enable and start the service:
sudo systemctl enable reddit-meme-scraper sudo systemctl start reddit-meme-scraper
The scraper supports webhook notifications for monitoring via Slack, Discord, or generic webhooks.
-
Configure in
config.json:{ "monitoring": { "enabled": true, "webhook": { "enabled": true, "url": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL", "type": "slack" } } } -
Supported webhook types:
slack- Slack incoming webhooksdiscord- Discord webhooksgeneric- Custom webhook format
-
Notifications sent:
- Startup/shutdown events
- Daily statistics reports
- Error alerts
- Successful meme batches
Perfect for your Raspberry Pi Zero W with e-ink display! The scraper can show real-time stats on supported e-ink displays.
-
Setup e-ink display (Raspberry Pi only):
chmod +x setup_display.sh ./setup_display.sh
-
Enable in
config.json:{ "display": { "enabled": true, "type": "epd2in13_V3" } } -
Supported displays:
epd2in13_V3- 2.13" V3 display (most common for pwnagotchi)epd2in7- 2.7" display
-
Display shows:
- Total memes scraped/sent/failed
- Last run time
- System uptime
- Current status (OK/ERROR)
- Real-time updates every 5 minutes
Note: The application works perfectly without display support. Display libraries are optional and will be gracefully skipped if not available.
{
"reddit": {
"subreddits": ["memes", "dankmemes", "wholesomememes"],
"sort_by": "hot",
"limit": 10,
"min_score": 100
},
"schedule": {
"interval_hours": 1
},
"filters": {
"image_only": true,
"exclude_nsfw": false,
"max_title_length": 200
},
"telegram": {
"enabled": true
},
"monitoring": {
"enabled": true,
"webhook": {
"enabled": true,
"url": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
"type": "slack"
}
},
"display": {
"enabled": true,
"type": "epd2in13_V3"
}
}# Start the service
sudo systemctl start reddit-meme-scraper
# Stop the service
sudo systemctl stop reddit-meme-scraper
# Restart the service
sudo systemctl restart reddit-meme-scraper
# Check service status
sudo systemctl status reddit-meme-scraper
# Enable service to start on boot
sudo systemctl enable reddit-meme-scraper
# Disable service from starting on boot
sudo systemctl disable reddit-meme-scraper# View live logs (follow mode)
journalctl -u reddit-meme-scraper -f
# View last 100 lines of logs
journalctl -u reddit-meme-scraper -n 100
# View logs since last boot
journalctl -u reddit-meme-scraper -b
# View logs from a specific time
journalctl -u reddit-meme-scraper --since "2024-05-28 20:00:00"
# View error logs only
journalctl -u reddit-meme-scraper -p err# Edit service configuration
sudo nano /etc/systemd/system/reddit-meme-scraper.service
# Reload systemd after configuration changes
sudo systemctl daemon-reload
# Verify service configuration
sudo systemctl cat reddit-meme-scraper# Check if service is enabled
sudo systemctl is-enabled reddit-meme-scraper
# Check service dependencies
sudo systemctl list-dependencies reddit-meme-scraper
# Check service resource usage
sudo systemctl status reddit-meme-scraper -l
# View detailed service information
sudo systemctl show reddit-meme-scraper- Check the logs in the project directory
- If running as a service, check Event Viewer
- View service status:
sudo systemctl status reddit-meme-scraper
- View logs:
journalctl -u reddit-meme-scraper -f
-
Application Not Starting
- Check if Python is installed correctly
- Verify all dependencies are installed
- Check the
.envfile for correct credentials
-
No Memes Being Sent
- Verify Reddit API credentials
- Check Telegram bot token and chat ID
- Ensure the bot is added to the target chat/channel
-
Service Not Starting
- Check service status and logs
- Verify file paths in service configuration
- Ensure correct permissions
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.