Support me on BuyMeACoffee
Download private YouTube/videos using a cookie file.
https://upekshaip.com/projects/-O0t36gRpfJR1p8KB7vU
- First, you need to add your bot to the logging channel and subscription channel. Both are required.
- Give me a star and fork this repository. Then change the _config.py file to config.py.
- Add your configuration for the config.py file.
-
sudo apt-get update
-
sudo apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
-
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
-
echo "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.list
-
sudo apt update
-
sudo apt install -y docker-ce docker-ce-cli containerd.io
-
docker -v
It is essential to have ffmpeg installed on your system because yt-dlp relies on it for merging streams (and in some cases, for transcoding or extracting thumbnails). To install ffmpeg on a Debian-based system, run:
-
sudo apt-get update
-
sudo apt-get install -y ffmpeg
- Verify installation:
-
ffmpeg -version
If you are deploying via Docker, ensure that ffmpeg is included in your Docker image. One simple way is to modify the Dockerfile to install ffmpeg during the build process. For example, add the following lines in your Dockerfile before copying the bot’s files:
FROM python:3.9-slim
# Install dependencies including ffmpeg
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Set work directory
WORKDIR /app
# Copy requirements.txt and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY . .
# Command to run the bot
CMD ["python", "your_bot_file.py"]
This way, the built Docker image will include ffmpeg and your bot will be able to use it.
-
git clone https://github.com/upekshaip/tg-ytdlp-bot.git
-
cd tg-ytdlp-bot
-
sudo mv _config.py config.py
-
nano config.py
- Now you can edit your config before the deployment.
- After your edit process, please follow the steps below.
-
sudo docker build . -t tg-public-bot
-
sudo docker ps -a
-
sudo docker run tg-public-bot
- Added a Config object for configurations.
- Can add a custom name for a playlist. The 1st video will start as "bla bla - Part 1" and so on.
You can specify a range if you need a custom name like -> (https://blabla.blaa*1*3*name) - No need to specify a range if there is only one video. Simply provide the URL (https://blabla.blaa).
- If you provide only a playlist URL, the bot will download the first video of that playlist.
- If you want to download a range of videos, specify a range like -> (https://blabla.blaa*1*3)
/check_cookie
- Check cookie file/help
- Help message/start
- Start the bot/clean
- Clean your working directory/usage
- See your usage
start
- Start the bothelp
- Send help textrun_time
- Show bot runtimelog
- Get user logs (e.g.,/log 10101010
)broadcast
- Send a message to all users (reply to any message with this command to broadcast it)clean
- Clean your working directoryusage
- Get all logscheck_cookie
- Check cookie filesave_as_cookie
- Save text as cookie (save text as cookie)download_cookie
- Download the cookie fileformat
- Choose media format optionsblock_user
- Block a user (e.g.,/block_user 10101010
)unblock_user
- Unblock a user (e.g.,/unblock_user 10101010
)all_users
- Get all usersall_blocked
- Get all blocked usersall_unblocked
- Get all unblocked users
- Download video with the real name.
- Download only the 1st video of the playlist.
- Download the given range of the playlist with the real name.
- Download the given range of the playlist with a custom name.
Video names will be like:- "name - Part 1"
- "name - Part 2"
- Added cookie download feature for each user.
- Added per-user database.
- Need to add a custom formatter selector for download.
- Need to add mp3 support.
- Need to add Google Drive support to store files.