A Python application that automatically reposts saved Instagram content to your own account with proper attribution.
- 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
- Python 3.7+
- Instagram account with valid credentials
- Required Python packages:
- instagrapi
- colorama
- python-dotenv
- schedule
- moviepy (for video processing)
-
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
.envfile 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
Run the script:
python insta_reposter.py
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
| 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 |
- 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
- 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
- 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)
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
MIT