Project Details:
Github Repository - https://github.com/upekshaip/tg-ytdlp-bot
Project Name: Telegram yt-dlp Cookie Bot
Starting Date: Jun 13, 2022
The Telegram yt-dlp Cookie Bot is a powerful Telegram bot designed to download videos, including private ones, directly into Telegram. It leverages the yt-dlp library to provide this functionality and also integrates with Firebase as a database for user management and activity tracking. This bot is unique in its ability to access private video files and can even download specific video ranges within playlists.
Project Overview:
This bot primarily serves the purpose of downloading YouTube or related video files directly into Telegram. It can handle playlists as well as private video files and playlists using cookies for authentication. Additionally, the bot includes admin commands for managing users and their interactions. It also allows users to rename the captions of video files by simply replying to the video with their desired caption. Here are some key features and components:
Languages / Frameworks and Libraries:
Python
Firebase (utilizing the pyrebase4 library)
Telegram API (Pyrogram)
yt-dlp
User Commands:
/start: Start the bot./help: Get help and usage instructions./clean: Clean your working directory./usage: View your usage statistics./save_as_cookie: Save a text file as a cookie.
/save_as_cookie This is your cookie text/check_cookie: Check the current cookie file.
Admin Commands:
/start: Start the bot./help: Get help and usage instructions./run_time: Display the bot's runtime./clean: Clean your working directory./usage: View your usage statistics./save_as_cookie: Save a text file as a cookie.
/save_as_cookie This is your cookie text/check_cookie: Check the current cookie file./log [user ID]: Get user logs.
/log 10101010/broadcast: Send a message to all users (requires replying to a message with this command)./download_cookie: Download a cookie file from a specific URL path./block_user [user ID]: Block a user.
/block_user 10101010/unblock_user [user ID]: Unblock a user.
/unblock_user 10101010/all_users: Get a list of all users./all_blocked: Get a list of all blocked users./all_unblocked: Get a list of all unblocked users.
Functionality of the Bot:
Downloading Videos: You can start the bot using the
/startcommand and download a video by sending a link like this:
https://youtu.be/qmq7UzSfr-U?si=ULTSESXg840uTREN.Downloading Playlists: To download a playlist, use a URL with a specified range like this. Below example will download the playlist from 5th video to 8th video.
https://www.youtube.com/watch?v=yOuqn4w1ozA&list=PL3-sRm8xAzY9gpXTMGVHJWy_FMD67NBed*5*8Custom Captions for Playlists: You can add custom captions to playlist downloads by setting a range and name in the URL:
https://www.youtube.com/watch?v=yOuqn4w1ozA&list=PL3-sRm8xAzY9gpXTMGVHJWy_FMD67NBed*5*8*Your custom name hereCaption Editing: Change the caption of a video by replying to it with your desired caption.
Usage Monitoring: To see your activity usage, simply send the
/usagecommand.Cookie Management: Set a cookie file for your downloads by sending the cookies.txt file to the bot. Check the current cookie file using
/check_cookie. You can also send cookie content as text:/save_as_cookieThis is the cookie content.Error Handling and Cleanup: If you encounter errors or need to clean up your working environment, use the
/cleancommand.
Installation (Deploy on VM):
First, You need to add your bot to the logging channel and subscription channel in Telegram. Both are required.
Give me a strar and fork this repository. Then change the _config.py file to config.py
Add your configuration for the config.py file.
Setup debian/any for docker
sudo apt-get updatesudo apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-commoncurl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpgecho "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.listsudo apt updatesudo apt install -y docker-ce docker-ce-cli containerd.iodocker -v
Setting the config.py file
git clone https://github.com/upekshaip/tg-ytdlp-bot.gitcd tg-ytdlp-botsudo mv _config.py config.pynano config.py
Now you can edit your config before the deployment
After your edit process please follow as below
Install Dockerfile
sudo docker build . -t tg-public-botsudo docker ps -asudo docker run tg-public-bot
Open Source
This bot is open source, and you can find the project repository on GitHub . We believe in the power of collaboration and welcome contributions from the community.
Contributing:
We encourage developers, testers, and enthusiasts to contribute to our project. Whether you want to fix a bug, add a feature, or help with documentation, your contributions are valuable. Please refer our repository for more information.
Summary:
This project is a powerful Telegram bot designed to facilitate video downloading from YouTube and related platforms directly into Telegram. Its unique feature is the ability to download private video files and playlists with ease. It was inspired by Anasty17's mirror-leech-telegram-bot. The project provides valuable knowledge and motivation for the development community, making it an interesting and innovative endeavor. Special thanks to Anasty17 for the inspiration behind this project.

