This project is a Python bot that downloads Instagram video links sent via Telegram and sends the video back to the user. It is designed to be hosted on Render as a Web Service, using Dockerfile for its entire functionality. It uses Flask to serve a simple web page to meet Render's port binding requirements.
Bot Link: IGXDOWN Bot
- Downloads videos and Reels from Instagram using
yt-dlp. - Easy-to-use Telegram bot interface with multi-language support (TR/EN).
- Manual language selection via the
/startcommand. - Simple and reliable deployment on Render with
Dockerfile. - Audio support for videos thanks to
ffmpeg. - Optional
INSTAGRAM_SESSIONIDusage for advanced cases.
This bot connects to the Telegram API using the python-telegram-bot library. Video downloading and sending are managed by the bot.py script. The script uses yt-dlp, a popular and powerful command-line tool, by running it through the subprocess module.
The ffmpeg dependency, which is necessary for merging separate video and audio streams, is automatically installed via the Dockerfile in the project's root directory.
The bot is deployed as a Web Service on Render. It uses Flask to serve a minimal web page, which satisfies Render's requirement for a bound port and allows for health checks. The main Telegram bot logic runs in a background thread, continuously listening for messages.
Follow these steps to run this bot with your own Telegram account on Render:
- Fork this Repository: Fork this GitHub repository to your own account.
- Get a Telegram Bot Token:
- If you don't have a bot, talk to BotFather on Telegram.
- Use the
/newbotcommand to create a new bot and follow the instructions. - Copy the API token that BotFather gives you. This token must be kept secret.
- Create/Login to Your Render Account: Go to Render.com. Signing in with your GitHub account will make it easier to access your repositories.
- Create a New Service:
- On the Render dashboard, click "New +" > "Web Service".
- Connect Your Repository:
- Connect your GitHub account to Render and select the repository you forked from the list, then click "Connect".
- Configure the Service:
- Name: Give your service a name (e.g.,
igxdown-bot). - Region: Choose a region closest to you (e.g.,
Frankfurt). - Branch: Select the
mainbranch. - Runtime: Render will automatically detect the
Dockerfilein your repository. Make sure "Docker" is selected as the runtime. In this case, you do not need to fill in the "Build Command" and "Start Command" fields. - Instance Type: You can start with the
Freeplan.
- Name: Give your service a name (e.g.,
- Add Environment Variables:
- Go to the "Advanced" section and click "Add Environment Variable". Add the following variables:
TELEGRAM_TOKEN: Paste the API token you got from BotFather.INSTAGRAM_SESSIONID(Optional): If you want to download private videos or bypass some access issues, you can add your Instagramsessionidhere.
- Go to the "Advanced" section and click "Add Environment Variable". Add the following variables:
- Deploy:
- Click the "Create Worker Service" button.
- Render will pull the code from your GitHub repository, build an image using the
Dockerfile(installingffmpegand Python dependencies in this step), and finally start your bot.
- Check the Logs:
- After the deployment is complete, you can monitor your bot's logs from the "Logs" tab in the Render dashboard. When you see messages like "Bot started...", your bot is running successfully.
This bot can download most public videos without a sessionid. However, setting the INSTAGRAM_SESSIONID environment variable in Render can be useful in the following cases:
- Downloading from Private Accounts.
- Videos that Require Login.
- Bypassing Rate Limiting / Blocking Issues: When anonymous requests are frequently restricted or blocked by Instagram.
If this environment variable is set, the bot will automatically pass this information to yt-dlp via a cookie file.
How to get INSTAGRAM_SESSIONID?
- Go to Instagram.com in your browser and log in to your account.
- Open the developer tools (usually F12).
- Navigate to the
Application(Chrome/Edge) orStorage(Firefox) tab and findCookies>https://www.instagram.com. - Find the cookie named
sessionidand copy its value. - Add this value to your service's environment variables on Render with the name
INSTAGRAM_SESSIONID.
bot.py: Contains the Python code for the main Telegram bot application.requirements.txt: Lists the required Python libraries.Dockerfile: Contains instructions to build the environment (Python + ffmpeg) where the application will run on Render.locales/: Contains JSON files for multi-language support (tr.json,en.json).README.md: This file (English).README_tr.md: Turkish version of the README.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.