Instagram Auto Reposter
A Python application that automatically reposts saved Instagram content to your own account with proper attribution.
Features
- Monitors your saved Instagram content (photos, videos, reels, IGTV, albums)
- Automatically reposts saved content to your account
- Likes original posts before reposting
- Customizable repost caption and check interval
- Credits original content creators in the caption
- Automatically removes posts from saved collection after reposting
- Option to keep downloaded media files
Requirements
- Python 3.7+
- Instagram account with valid credentials
- Required Python packages:
- instagrapi
- colorama
- python-dotenv
- schedule
- moviepy (for video processing)
Installation
- Clone this repository:
git clone https://github.com/Likhithsai2580/InstaRepost.git
cd InstaRepost
- Install required packages:
pip install instagrapi colorama python-dotenv schedule moviepy==1.0.3
- Create a
.env file with your Instagram credentials:
INSTAGRAM_USERNAME=your_username
INSTAGRAM_PASSWORD=your_password
REPOST_CAPTION="Reposted"
CHECK_INTERVAL_MINUTES=30
HISTORY_FILE=repost_history.json
MEDIA_FOLDER=instagram_media
KEEP_MEDIA=False
Usage
Run the script:
The script will:
- Log into your Instagram account (with cookie support for persistent sessions)
- Check for saved posts at the interval specified in your .env file
- Process each saved post (like, download, repost, unsave)
- Keep track of reposted content to avoid duplicates
Environment Variables
| Variable |
Description |
Default |
INSTAGRAM_USERNAME |
Your Instagram username |
(Required) |
INSTAGRAM_PASSWORD |
Your Instagram password |
(Required) |
REPOST_CAPTION |
Caption prefix for reposted content |
“Reposted” |
CHECK_INTERVAL_MINUTES |
How often to check for new saved posts (in minutes) |
30 |
HISTORY_FILE |
File to store repost history |
repost_history.json |
MEDIA_FOLDER |
Folder to temporarily store downloaded media |
instagram_media |
COOKIES_FILE |
File to store Instagram session cookies |
instagram_cookies.json |
KEEP_MEDIA |
Whether to keep downloaded media files (true/false) |
False |
How It Works
- Save a post on Instagram
- The script detects the saved content during its next check
- The script likes the original post
- The content is downloaded temporarily
- The content is reposted to your profile with proper attribution
- The post is removed from your saved collection
- The post is added to history to avoid reposting
Security and Error Handling
- Cookie-based authentication to maintain login sessions
- Comprehensive error handling and retry mechanisms
- Colorized console output for better debugging
- API connectivity checks to handle Instagram limitations
Important Notes
- Instagram has rate limits. Setting a very short check interval may trigger account restrictions.
- Using automated tools with Instagram may violate their Terms of Service. Use at your own risk.
- For security, never share your .env file containing your credentials.
- The script works best when run continuously (e.g., on a server or cloud instance)
Troubleshooting
If you encounter issues:
- Check the console output for error messages
- Ensure your Instagram credentials are correct
- If you get login challenges, the script will prompt for verification codes
- For persistent login issues, delete the cookies file and try again
License
MIT