.github | ||
assets | ||
conf | ||
tools | ||
ytdlbot | ||
.dockerignore | ||
.gitignore | ||
.gitmodules | ||
app.json | ||
docker-compose.yml | ||
Dockerfile | ||
LICENSE | ||
Makefile | ||
Procfile | ||
README.md | ||
requirements.txt | ||
worker.yml |
ytdlbot
YouTube Download Bot🚀
Download videos from YouTube and other platforms through a Telegram Bot
Can't deploy? Fork to your personal account and deploy it there!
Usage
Send link directly to the bot. Any Websites supported by youtube-dl will also work.
Limitations of my bot
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
You can choose to become 'VIP' if you really need large traffic. And also, you could always deploy your own bot.
Features
- 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.
How to deploy?
You can deploy this bot on any platform that supports Python.
Heroku
Use the button above! It should work like a magic but with limited functionalities.
Run natively on your machine
- 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
Docker
Some functions, such as VIP, ping will be disabled.
docker run -e APP_ID=111 -e APP_HASH=111 -e TOKEN=370FXI bennythink/ytdlbot
Complete deployment guide for docker-compose
- contains every functionality
- compatible with amd64, arm64 and armv7l
1. get docker-compose.yml
Download docker-compose.yml
file to a directory
2. create data directory
mkdir data
mkdir env
3. configuration
3.1. set environment variables
vim env/ytdl.env
you can configure all the following environment variables:
-
WORKERS: default 200
-
APP_ID: REQUIRED
-
APP_HASH: REQUIRED
-
TOKEN: REQUIRED
-
REDIS: REQUIRED ⚠️ 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
3.2 Set up init data
3.2.1 Create MySQL db
docker-compose up -d
docker-compose exec mysql bash
mysql -u root -p
> create database vip;
3.2.2 Setup flower db in ytdlbot/ytdlbot/data
{} ~ 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()
3.2.3 Setup instagram cookies
You can use this extension Get cookies.txt to get instagram cookies
vim data/instagram.com_cookies.txt
# paste your cookies
3.3 Tidy docker-compose.yml
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.
4. run
4.1. standalone mode
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
4.2 VIP mode
You'll have to start MySQL and redis to support VIP mode.
docker-compose up -d mysql redis ytdl
4.3 Celery worker mode
Firstly, set ENABLE_CELERY
to true. And then, on one machine:
docker-compose up -d
On the other machine:
docker-compose -f worker up -d
⚠️ Bear in mind don't publish redis directly on the internet! You can use WireGuard to wrap it up.
Command
start - Let's start
about - Want to contribute?
ping - Bot running status
help - Anything troubles you?
ytdl - Download video in group
vip - Join VIP
terms - View Terms of Service
settings - Set your preference
direct - Download file directly
Test data
Test video
https://www.youtube.com/watch?v=BaW_jenozKc
Test Playlist
https://www.youtube.com/playlist?list=PL1Hdq7xjQCJxQnGc05gS4wzHWccvEJy0w
Test m3u8
https://dmesg.app/m3u8/prog_index.m3u8
Donation
License
Apache License 2.0