Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🎧 TelegramBotYTMusicLoader

A Telegram bot that downloads audio from YouTube and delivers it straight to your chat.

🇬🇧 English · 🇺🇦 Українська

.NET Docker yt-dlp Platform


📖 About

TelegramBotYTMusicLoader is a self-hosted Telegram bot built on .NET 10 that lets you send a YouTube link (or a search query) and get back an audio track, ready to listen to right inside Telegram — no ads, no extra apps, no manual conversion.

Under the hood it relies on the battle-tested yt-dlp for extraction and ffmpeg for audio processing, wrapped in a clean .NET application and shipped as a ready-to-run Docker image.

✨ Features

  • 🔗 Link → Audio — send a YouTube video or playlist link and receive an MP3 in return
  • ⚙️ Powered by yt-dlp & ffmpeg — reliable extraction and high-quality audio conversion
  • 🍪 Cookie support — use cookies.txt to access age-restricted or region-locked content
  • 🗄️ EF Core data layer — persistent storage via Entity Framework Core (dotnet-ef tooling included)
  • 🐳 Docker-first — a single Dockerfile builds and runs the whole bot, dependencies included
  • 🧩 .NET 10 solution — clean, modern C# codebase (TelegramBotYtMusic.sln)

🛠️ Tech Stack

Component Purpose
.NET 10 (C#) Core application / bot logic
Telegram Bot API Chat interface
yt-dlp (Python) Fetching audio/video from YouTube
ffmpeg Audio extraction & conversion
Entity Framework Core Data persistence
Docker Packaging & deployment

🚀 Getting Started

Prerequisites

Option 1 — Run with Docker (recommended)

# Clone the repository
git clone https://github.com/DmitryMagich/TelegramBotYTMusicLoader.git
cd TelegramBotYTMusicLoader

# Build the image
docker build -t telegram-yt-music-bot .

# Run the container
docker run -d \
  --name yt-music-bot \
  -e TELEGRAM_BOT_TOKEN="your_bot_token_here" \
  -v $(pwd)/Downloads:/app/Downloads \
  telegram-yt-music-bot

⚠️ Check appsettings.json inside TelegramBotYtMusic/ for the exact configuration keys expected by your build (bot token, database connection string, etc.) — adjust environment variables accordingly.

Option 2 — Run locally

git clone https://github.com/DmitryMagich/TelegramBotYTMusicLoader.git
cd TelegramBotYTMusicLoader

# Restore & build
dotnet restore
dotnet build

# Apply EF Core migrations, if any
dotnet tool restore
dotnet ef database update --project TelegramBotYtMusic

# Run
dotnet run --project TelegramBotYtMusic

Make sure ffmpeg, python3, and yt-dlp (pip install yt-dlp) are available on your PATH.

🍪 Using cookies.txt

Some YouTube videos require authentication (age-restricted or region-locked content). Export your browser cookies in Netscape format into cookies.txt and place it at the project root — the bot automatically picks it up and forwards it to yt-dlp.

💬 Usage

  1. Start a chat with your bot on Telegram.
  2. Send a YouTube link (video or playlist).
  3. Wait while the bot downloads and converts the audio.
  4. Receive the ready-to-play audio file directly in chat.

📁 Project Structure

TelegramBotYTMusicLoader/
├── TelegramBotYtMusic/        # Main application source code
├── TelegramBotYtMusic.sln     # .NET solution file
├── Dockerfile                 # Container build definition
├── dotnet-tools.json          # Local .NET tools (dotnet-ef)
├── cookies.txt                # Optional yt-dlp auth cookies
└── .gitignore

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to open a pull request or issue.

⚠️ Disclaimer

This tool is intended for downloading content you own or have the right to download (e.g. royalty-free tracks, your own uploads, or content explicitly permitted for offline use). Respect YouTube's Terms of Service and applicable copyright law in your jurisdiction.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages