Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTube Downloader Bot

A simple Telegram bot built with aiogram and yt-dlp that listens for YouTube links in chats, asks what to download, and sends back either MP3 audio, 720p video, or 1080p video.

Prerequisites

  • A Telegram bot token (from @BotFather)
  • API_ID and API_HASH (from https://my.telegram.org)
  • A valid cookies.txt file exported from your browser (optional, but required for some videos)

Installation

  1. Clone this repo:

    git clone https://github.com/timamz/link-to-audio-bot
    cd link-to-audio-bot

Configuration

Extracting cookies.txt

  1. Open an incognito/private Chrome window.
  2. Log into YouTube.
  3. Visit https://www.youtube.com/robots.txt to isolate the YouTube session.
  4. Export only the youtube.com cookies (e.g., using the "Get cookies.txt LOCALLY" extension).

Create a .env file in the project root (or set environment variables directly):

API_ID=1234567
API_HASH=your_api_hash
BOT_TOKEN=your_bot_token
COOKIE_FILE=/app/cookies.txt
PORT=8080
  • API_ID and API_HASH: Obtain from https://my.telegram.org
  • BOT_TOKEN: Provided by @BotFather
  • COOKIE_FILE: Optional path to a mounted cookies.txt
  • PORT: Optional healthcheck port exposed by the container

Usage

Build and run in one command with Docker Compose:

docker compose up --build -d

Stop the bot:

docker compose down

If you do not need YouTube cookies, remove the volumes section from compose.yaml and omit COOKIE_FILE from .env.

Check that the bot is healthy:

docker compose logs
curl http://localhost:8080/healthz

Once running, send a YouTube link into any chat with the bot. It will show buttons for:

  • 🎧 Audio MP3
  • 🎬 Video 720p
  • 🎬 Video 1080p

After you choose an option, it downloads and sends the selected file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages