YouTube Download Bot🚀
Download videos from YouTube and other platforms through a Telegram Bot
READ FAQ FIRST IF YOU ENCOUNTER ANY ISSUES.
Can't deploy? Fork to your personal account and deploy it there!
Starting November 28, 2022, free Heroku Dynos, free Heroku Postgres, and free Heroku Data for Redis® plans will no longer be available. Heroku Announcement
Send link directly to the bot. Any Websites supported by youtube-dl will also work.
I don't have unlimited servers and bandwidth, so I have to make some restrictions.
- 10 GiB one-way traffic per 24 hours for each user
- maximum 5 minutes streaming conversion support
- maximum 3 subscriptions
You can choose to become 'VIP' if you really need large traffic. And also, you could always deploy your own bot.
- fast download and upload.
- ads free
- support progress bar
- audio conversion
- playlist support
- VIP support
- support different video resolutions
- support sending as file or streaming as video
- supports celery worker distribution - faster than before.
- subscriptions to YouTube Channels
- cache mechanism - download once for the same video.
You can deploy this bot on any platform that supports Python.
Use the button above! It should work like a magic but with limited functionalities.
- clone code
- install ffmpeg
- install Python 3.6+
- pip3 install -r requirements.txt
- set environment variables
TOKEN
,APP_ID
andAPP_HASH
, and more if you like. python3 ytdl_bot.py
Some functions, such as VIP, ping will be disabled.
docker run -e APP_ID=111 -e APP_HASH=111 -e TOKEN=370FXI bennythink/ytdlbot
- contains every functionality
- compatible with amd64, arm64 and armv7l
Download docker-compose.yml
file to a directory
mkdir data
mkdir env
vim env/ytdl.env
you can configure all the following environment variables:
-
PYRO_WORKERS: number of workers for pyrogram, default is 100
-
WORKERS: workers count for celery
-
APP_ID: REQUIRED, get it from https://core.telegram.org/
-
APP_HASH: REQUIRED
-
TOKEN: REQUIRED
-
REDIS: REQUIRED if you need VIP mode and cache
⚠️ Don't publish your redis server on the internet.⚠️ -
OWNER: owner username
-
QUOTA: quota in bytes
-
EX: quota expire time
-
MULTIPLY: vip quota comparing to normal quota
-
USD2CNY: exchange rate
-
VIP: VIP mode, default: disable
-
AFD_LINK
-
COFFEE_LINK
-
COFFEE_TOKEN
-
AFD_TOKEN
-
AFD_USER_ID
-
AUTHORIZED_USER: users that could use this bot, user_id, separated with
,
-
REQUIRED_MEMBERSHIP: group or channel username, user must join this group to use the bot. Could be use with above
AUTHORIZED_USER
-
ENABLE_CELERY: Distribution mode, default: disable. You'll can setup workers in different locations.
-
MYSQL_HOST: you'll have to setup MySQL if you enable VIP mode
-
MYSQL_USER
-
MYSQL_PASS
-
GOOGLE_API_KEY: YouTube API key, required for YouTube video subscription.
-
AUDIO_FORMAT: audio format, default is m4a. You can set to any known and supported format for ffmpeg. For example,
mp3
,flac
, etc.⚠️ m4a is the fastest. Other formats may affect performance. -
ARCHIVE_ID: group or channel id/username. All downloads will send to this group first and then forward to end user. Inline button will be lost during the forwarding.
If you only need basic functionality, you can skip this step.
Required for VIP, settings, YouTube subscription.
docker-compose up -d
docker-compose exec mysql bash
mysql -u root -p
> create database ytdl;
Required if you enable celery and want to monitor the workers.
{} ~ python3
Python 3.9.9 (main, Nov 21 2021, 03:22:47)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbm;dbm.open("flower","n");exit()
Required if you want to support instagram.
You can use this extension Get cookies.txt to get instagram cookies
vim data/instagram.com_cookies.txt
# paste your cookies
In flower
service section, you may want to change your basic authentication username password and publish port.
You can also limit CPU and RAM usage by adding an `deploy' key:
deploy:
resources:
limits:
cpus: '0.5'
memory: 1500M
Be sure to use --compatibility
when deploying.
If you only want to run the mode without any celery worker and VIP mode, you can just start ytdl
service
docker-compose up -d ytdl
You'll have to start MySQL and redis to support VIP mode, subscription and settings.
docker-compose up -d mysql redis ytdl
Firstly, set ENABLE_CELERY
to true. And then, on one machine:
docker-compose up -d
On the other machine:
docker-compose -f worker.yml up -d
start - Let's start
about - What's this bot?
ping - Bot running status
help - Help
ytdl - Download video in group
vip - Join VIP
terms - View Terms of Service
settings - Set your preference
direct - Download file directly
sub - Subscribe to YouTube Channel
unsub - Unsubscribe from YouTube Channel
sub_count - Check subscription status, owner only.
uncache - Delete cache for this link
https://www.youtube.com/watch?v=BaW_jenozKc
https://www.youtube.com/playlist?list=PL1Hdq7xjQCJxQnGc05gS4wzHWccvEJy0w
https://dmesg.app/m3u8/prog_index.m3u8
https://twitter.com/nitori_sayaka/status/1526199729864200192 https://twitter.com/BennyThinks/status/1475836588542341124
Apache License 2.0