A production-ready automated Instagram meme posting bot that scrapes copyright-safe memes from Pinterest and posts them with intelligent scheduling. Built with Node.js, Puppeteer, and the Instagram Private API.
- π― Smart Meme Scraping: Finds copyright-safe memes from Pinterest
- π€ Automated Posting: Posts to Instagram with random, engaging captions
- π§ Human-like Behavior: Random delays and stealth techniques
- π Multi-language Support: Alternates between English and Hinglish memes
- π Session Management: Persistent Instagram login sessions
- π± CLI Interface: Easy-to-use command line interface
- π¦ NPM Package: Use programmatically in your Node.js projects
npm install -g instagram-meme-botnpx instagram-meme-bot config # Setup credentials
npx instagram-meme-bot run # Start the botinstagram-meme-bot configInteractive setup for Instagram credentials and optional Puppeteer settings.
# Run continuously (recommended)
instagram-meme-bot run
# Run once and exit
instagram-meme-bot run --onceinstagram-meme-bot versionCreate a .env file in your project directory:
INSTA_USERNAME=your_instagram_username
INSTA_PASSWORD=your_instagram_password
PUPPETEER_EXECUTABLE_PATH=/path/to/chrome # OptionalUse the bot in your Node.js applications:
const InstagramMemeBot = require('instagram-meme-bot');
const bot = new InstagramMemeBot();
// Run once
async function postSingleMeme() {
try {
await bot.runOnce();
console.log('Meme posted successfully!');
} catch (error) {
console.error('Error:', error.message);
}
}
// Run continuously
async function startBot() {
try {
await bot.run(); // Runs indefinitely
} catch (error) {
console.error('Bot error:', error.message);
}
}
// Setup configuration programmatically
async function setupConfig() {
await bot.setupConfig();
}- Node.js >= 14.0.0
- Instagram account
- Chrome/Chromium browser (automatically installed with Puppeteer)
-
Install the package
npm install -g instagram-meme-bot
-
Configure credentials
instagram-meme-bot config
-
Start the bot
instagram-meme-bot run
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "start"]| Variable | Description | Required | Default |
|---|---|---|---|
INSTA_USERNAME |
Instagram username | β | - |
INSTA_PASSWORD |
Instagram password | β | - |
PUPPETEER_EXECUTABLE_PATH |
Custom Chrome path | β | Auto-detected |
- Posting Frequency: 40-120 minutes between posts (randomized)
- Meme Sources: Pinterest (copyright-safe images only)
- Caption Style: Random engaging captions with proper credits
- Error Handling: Automatic retry with exponential backoff
# Clear saved session and reconfigure
rm ig-session.json
instagram-meme-bot config# Install Chrome dependencies (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wgetThe bot automatically handles Instagram rate limits with intelligent delays. If you encounter frequent rate limits:
- Reduce posting frequency
- Use a dedicated Instagram account
- Ensure your account is in good standing
# Increase Node.js memory limit
node --max-old-space-size=4096 bin/cli.js run| Error | Cause | Solution |
|---|---|---|
checkpoint |
Instagram security check | Complete verification in Instagram app |
rate limit |
Too many requests | Wait for automatic retry |
Protocol error |
Puppeteer connection issue | Restart bot, check Chrome installation |
instagram-meme-bot/
βββ bin/
β βββ cli.js # CLI entry point
βββ src/
β βββ index.js # Main package export
β βββ bot.js # Core bot logic
β βββ instagram.js # Instagram posting
β βββ scraper.js # Pinterest scraping
β βββ config.js # Configuration management
β βββ utils.js # Utility functions
βββ test/
β βββ utils.test.js # Jest tests
βββ .eslintrc.js # ESLint configuration
βββ .prettierrc # Prettier configuration
βββ .npmignore # NPM ignore rules
βββ package.json # Package metadata
βββ LICENSE # MIT License
βββ README.md # This file
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Run linting:
npm run lint - Run tests:
npm test - Commit changes:
git commit -am 'Add feature' - Push to branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
This project is for educational purposes only. Please:
- Use responsibly and respect Instagram's Terms of Service
- Don't spam or post inappropriate content
- Give proper credit to original meme creators
- Use a dedicated account for automation
- Puppeteer Extra for stealth scraping
- Instagram Private API for Instagram integration
- Pinterest for providing a source of creative content
- π Report Issues
- π¬ Discussions
- π§ Email: amankk179102@gmail.com
Made with β€οΈ by Aman Kumar