CuteBot YTD is the acronym for CuteBot YouTube Downloader.
The objective of this project is to develop a bot for the Telegram platform capable of downloading videos and audios from YouTube videos and sending them to the user who made the request. Throughout this README you will find instructions for creating your own bot and executing this code.
The first step to creating a bot is to start a conversation with BotFather, BotFather is a bot from Telegram itself that creates other bots. After that follow these simple steps:
- Start a conversation with /start
- Enter /newbot command
- Make a name for your bot, don't be worry you can change it later
- Make a username for your bot, be carefull you CANNOT change after this
- Copy the API TOKEN
Congratulations, you made a bot!
- FFMPEG
- Python 3.7 or superior
Windows:
https://www.ffmpeg.org/download.html#build-windows
MacOS
brew install ffmpeg
Linux (Ubuntu)
sudo apt-get install ffmpeg
First of all clone this repository into you computer
git clone https://github.com/DaniloNicacio/TelegramBot.git
CD into folder
cd TelegramBot
Create a .env file to save your API TOKEN, in this example we are using Nano but feel free to use any editor you want
nano .env
Use this structure in your .env file:
BOT_TOKEN="YOUR_TOKEN_GOES_HERE"
After this install the python dependencies with:
pip install -r requirements.txt
And run the code with:
python main.py
or
python3 main.py
To test your bot open the Telegram into you Browser or Mobile App and search for the bot username, the username has this structure: @botusername
The bot only have three commands:
This command will download the video and send it to user, due to internet conection and file size maybe gonna take a while to send it
This command will download the audio and send it to user, this command have support to playlists too
Basically is a welcome message with the commands and previous funcionalities
After all my tests i can list these limitations:
- It's not possible to download videos from playlist links
- Videos that exceed 1 hour cannot be downloaded
- If one of the videos in playlist is privated, the /downloadaudio will not send the audios
- The bot does not handle if the user inserts a link that is not from YouTube
- The get_url function will only return the first result of the search case the user enter a name instead a valid url
- The download commands can accept the name of the video, but if the video name contains spaces it will download the video based on the first word
- If the user enters a name with an accent in the download commands, the bot will not be able to download the video