This is a Telegram bot that receives URL to a video for popular sites like Instagram, TikTok, YouTube, etc. and responds with a downloaded video. It is convenient for sharing content with your friends and family.
- Create a new bot using Bot Father (https://t.me/BotFather). Remember your token
- Acquire API ID and Hash from https://my.telegram.org/apps. Remember them
- Clone this repository:
git clone https://github.com/marko/MarkoDownloadBot.git - Navigate to the project directory:
cd MarkoDownloadBot - Create file
.envwith this content:
TELEGRAM_API_ID=<api_id>
TELEGRAM_API_HASH=<api_hash>
TELEGRAM_BOT_API_TOKEN=<bot_token>
ADMIN_USERNAME=<your_telegram_username>
COOKIES_FILE=/path/to/your/cookies.txt
- Run the bot using docker compose:
docker compose up -d - Write
/startto your new Telegram bot
-
Video Download: Simply send a URL to the bot, and it will download and send the video to you.
-
/audio [URL]: Use this command followed by an audio URL to download and receive audio files. -
/helpor/start: Displays a help message with information about how to use the bot.
The following commands are available only to the admin user specified in ADMIN_USERNAME:
-
/stats: Provides detailed usage statistics of the bot, including video/audio requests, errors, and top users. -
/users: Shows the total number of registered active users. -
/broadcast <message>: Sends a message to all active bot users. Example:/broadcast Hello! The bot will be down for maintenance at 10 PM.The broadcast feature automatically:
- Tracks which users have blocked the bot
- Marks blocked users as inactive
- Reactivates users when they return
- Only sends messages to active users
To download media, just send a valid video or audio link to the bot, and it will handle the rest!
The bot automatically tracks all users who interact with it, storing their:
- Chat ID
- Username
- First and last name
- Active status
- Last interaction timestamp
When users block the bot, they are automatically marked as inactive and won't receive future broadcasts. If they return and interact with the bot again, they are automatically reactivated.
To use a custom cookies file with yt-dlp:
- Create a cookies file (e.g.,
cookies.txt) with the necessary cookies. - Add the following line to your
.envfile:COOKIES_FILE=/path/to/your/cookies.txt - Restart the bot using
docker compose up -d
If no custom cookies file is specified, an empty cookies file will be used by default.
Contributions are welcome! If you have any ideas or improvements, feel free to submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for more information.
