This project automates the process of uploading videos to Instagram by fetching video links and captions from a Google Sheet, downloading the videos, and posting them to an Instagram account all by itself. It is designed to run on a schedule, processing a limited number of videos at a time, making it ideal for managing content uploads efficiently.
- ✅ Fetches video links and captions from Google Sheets.
- ✅ Downloads videos automatically using yt-dlp.
- ✅ Uploads videos to Instagram with description and hashtags(from the original video).
- ✅ Deletes processed videos after successful uploads.
- ✅ Supports persistent Instagram sessions to avoid repeated logins.
- ✅ Processes a configurable number of videos per run.
Follow these steps to set up and run the project locally or in a Docker container.
git clone https://github.com/ahmad-ash/smauto
cd smautopython -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windowspip install -r requirements.txt-
Google Sheets API Credentials:
- Download the
credentials.jsonfile for your Google Service Account. - Place it in the root directory of the project.
- Download the
-
Instagram Session:
- The program will automatically create a
session.jsonfile after the first login. - Ensure this file is stored securely and excluded from version control.
- The program will automatically create a
-
Environment Variables:
- Create a
.envfile in the root directory and add the following:IG_USERNAME=your_instagram_username IG_PASSWORD=your_instagram_password SHEET_ID=your_google_sheet_id SHEET_RANGE=Sheet1!A2:B
- Create a
To run the project locally:
python main.pyTo build and run the project in a Docker container:
docker build -t smauto .
docker run --rm smauto.
├── main.py # Main script to run the bot
├── instagram.py # Handles Instagram login and uploads
├── downloader.py # Downloads videos using yt-dlp
├── google_sheet.py # Fetches links and captions from Google Sheets
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── .env # Environment variables (excluded from Git)
├── session.json # Instagram session file (excluded from Git)
├── credentials.json # Google Sheets API credentials (excluded from Git)
└── processed_links.txt # Tracks processed links (excluded from Git)
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature-name" - Push to your fork and submit a pull request.
This project is licensed under the MIT License.
For issues or feedback, feel free to reach out:
- 📧 Email: [email protected]
- 🚀 LinkedIn: @Ahmad Ashfaq