The most robust Telegram music bot that actually works β even on datacenter IPs.
Sends AI-tagged MP3 files with cover art, artist metadata, and embedded lyrics directly in Telegram.
- π΅ High-quality MP3 downloads (192kbps) from YouTube & SoundCloud
- π€ AI Metadata Extraction β Groq AI + JioSaavn identify the exact song, artist & album from any vague query
- πΌοΈ Smart Cover Art β Searches multiple music databases, falls back to YouTube thumbnail
- π Lyrics Embedding β Paste lyrics and they get embedded directly into the MP3 ID3 tags
- π‘οΈ Multi-layer YouTube bypass β PO Token server, mweb client spoofing, EJS JS challenge solver, cookies
- π Automatic SoundCloud fallback β If YouTube fails, SoundCloud takes over seamlessly
The bot uses a 9-layer anti-bot bypass stack to reliably download from YouTube even on VPS/datacenter IPs:
| Layer | What it does |
|---|---|
| mweb + tv client | Bypasses SABR streaming (which 403s the web client) |
| cookies.txt | Authenticates as a real Google user |
| PO Token server | Generates Proof-of-Origin tokens via bgutil |
| EJS challenge solver | Decrypts YouTube JS signature challenges via Node.js |
| IPv4 forcing | Prevents IPv6 blackhole hangs on EC2 |
| AI-enhanced queries | Groq AI cleans user input β ytsearch1: gets exact correct video |
| SoundCloud fallback | Safety net if all YouTube layers fail |
- Python 3.11+
- FFmpeg
- Node.js (auto-downloaded if missing)
- A Telegram bot token (from @BotFather)
- A Groq API key (free at console.groq.com)
- YouTube
cookies.txt(Netscape format, exported from your browser)
git clone https://github.com/stack-rishi/LyrifusionBot.git
cd LyrifusionBot
python3.11 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtCopy the example env file and fill in your secrets:
cp .env.example .envEdit .env with your values:
# Your Telegram bot token from @BotFather
TELEGRAM_BOT_TOKEN=your_token_here
# Your Groq API key from https://console.groq.com
GROQ_API_KEY=your_groq_key_here
# Path to YouTube cookies file (optional)
COOKIES_FILE=cookies.txtExport your YouTube cookies to cookies.txt in Netscape format using the Get cookies.txt LOCALLY Chrome extension while logged into your Google account.
β οΈ Important: Cookies expire over time. If YouTube downloads start failing, re-exportcookies.txt.π‘ Legacy support: If you prefer, you can still use
token.txtandgroq_key.txtfiles instead of.envβ the bot checks both.
python3.11 bot.pyFor 24/7 deployment on a VPS:
tmux new -s bot
python3.11 bot.py
# Detach: Ctrl+B then DIf you have Docker and Docker Compose installed, you can build and run the entire stack (including Python, Node.js, and FFmpeg) in one command:
docker compose up --build -dTo view logs:
docker compose logs -fSee DOCUMENTATION.md for a full AWS EC2 (Amazon Linux 2023) setup guide including FFmpeg installation, Python 3.11 upgrade, and tmux persistence.
.
βββ bot.py # Main bot β all logic lives here
βββ Dockerfile # Container build definition
βββ docker-compose.yml # Docker service composition
βββ LICENSE # MIT License
βββ lyrifusion_banner.gif # Project banner image
βββ .env.example # Template for environment variables (safe to share)
βββ .env # YOUR secrets β never committed (gitignored)
βββ requirements.txt # Python dependencies
βββ .gitignore # Prevents secrets from being committed
βββ README.md # This file
βββ DOCUMENTATION.md # Full technical architecture & deployment guide
βββ documentation.txt # Plain-text copy of documentation
π
.env,token.txt,groq_key.txt, andcookies.txtare gitignored and never pushed to GitHub.
- User sends a song name β Groq AI + JioSaavn identify exact title, artist, album
- Bot shows cover art β searched from music databases or YouTube thumbnail
- User confirms cover β bot builds AI-enhanced search query and downloads via yt-dlp
- User pastes lyrics β embedded into MP3 ID3 tags via mutagen
- Bot sends tagged MP3 β with cover art, title, artist, album, and lyrics embedded
| Variable | Description | Required |
|---|---|---|
TELEGRAM_BOT_TOKEN |
Telegram bot token from @BotFather | β Yes |
GROQ_API_KEY |
Groq AI API key from console.groq.com | β Yes |
COOKIES_FILE |
Path to YouTube cookies file (Netscape format) | Optional |
This bot is for personal and educational use only. Downloading copyrighted content may violate YouTube's Terms of Service and applicable copyright laws in your country. Use responsibly.
Made with β€οΈ by @stack-rishi
Contact on Telegram: @Ri5h11