install YouTube downloader on server and termux install
bash <(curl -fsSL https://raw.githubusercontent.com/Ptechgithub/ytdl/main/install.sh)
- fast download and upload.
- ads free
- support progress bar
- audio conversion
- playlist support
- payment 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.
- support instagram posts
This bot can be deployed on any platform that supports Python.
To deploy this bot, follow these steps:
- Clone the code from the repository.
- Install FFmpeg.
- Install Python 3.6 or a later version.
- Install Aria2 and add it to the PATH.
- Install the required packages by running
pip3 install -r requirements.txt
. - Set the environment variables
TOKEN
,APP_ID
,APP_HASH
, and any others that you may need. - Run
python3 ytdl_bot.py
.
mkdir data
mkdir env
vim env/ytdl.env
You can configure all the following environment variables:
- WORKERS: workers count for celery
- PYRO_WORKERS: number of workers for pyrogram, default is 100
- 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.⚠️ - EXPIRE: token expire time, default: 1 day
- ENABLE_VIP: enable VIP mode
- OWNER: owner username
- AUTHORIZED_USER: only authorized users can use the bot
- REQUIRED_MEMBERSHIP: group or channel username, user must join this group to use the bot
- ENABLE_CELERY: celery mode, default: disable
- ENABLE_QUEUE: celery queue
- BROKER: celery broker, should be redis:https://redis:6379/0
- MYSQL_HOST:MySQL host
- MYSQL_USER: MySQL username
- MYSQL_PASS: MySQL password
- AUDIO_FORMAT: default audio format
- ARCHIVE_ID: forward all downloads to this group/channel
- IPv6 = os.getenv("IPv6", False)
- ENABLE_FFMPEG = os.getenv("ENABLE_FFMPEG", False)
- PROVIDER_TOKEN: stripe token on Telegram payment
- PLAYLIST_SUPPORT: download playlist support
- ENABLE_ARIA2: enable aria2c download
- FREE_DOWNLOAD: free download count per day
- TOKEN_PRICE: token price per 1 USD
- GOOGLE_API_KEY: YouTube API key, required for YouTube video subscription.
- RCLONE_PATH: rclone path to upload files to cloud storage
start - Let's start
about - What's this bot?
ping - Bot running status
help - Help
ytdl - Download video in group
settings - Set your preference
buy - Buy token
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, owner only.
purge - Delete all tasks, owner only.
Forked: tgbot-collection