Skip to content

stack-rishi/LyrifusionBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LyriFusion Banner



🎡 LyriFusion Bot

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.

Try the Bot


✨ Features

  • 🎡 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

πŸ—οΈ Architecture

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

πŸš€ Quick Start

Requirements

  • 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)

Installation

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.txt

Configuration

Copy the example env file and fill in your secrets:

cp .env.example .env

Edit .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.txt

Export 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-export cookies.txt.

πŸ’‘ Legacy support: If you prefer, you can still use token.txt and groq_key.txt files instead of .env β€” the bot checks both.

Run

Option A: Manual Setup (Local/VPS)

python3.11 bot.py

For 24/7 deployment on a VPS:

tmux new -s bot
python3.11 bot.py
# Detach: Ctrl+B then D

Option B: Docker Setup (Recommended)

If 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 -d

To view logs:

docker compose logs -f

☁️ Deploying on AWS EC2

See DOCUMENTATION.md for a full AWS EC2 (Amazon Linux 2023) setup guide including FFmpeg installation, Python 3.11 upgrade, and tmux persistence.


πŸ“¦ Project Structure

.
β”œβ”€β”€ 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, and cookies.txt are gitignored and never pushed to GitHub.


πŸ“‹ How It Works

  1. User sends a song name β†’ Groq AI + JioSaavn identify exact title, artist, album
  2. Bot shows cover art β†’ searched from music databases or YouTube thumbnail
  3. User confirms cover β†’ bot builds AI-enhanced search query and downloads via yt-dlp
  4. User pastes lyrics β†’ embedded into MP3 ID3 tags via mutagen
  5. Bot sends tagged MP3 β†’ with cover art, title, artist, album, and lyrics embedded

πŸ”§ Environment Variables

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

⚠️ Disclaimer

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

About

🎡 Premium Telegram Music Bot. Downloads HQ MP3s from YouTube & SoundCloud using a 9-layer bypass stack (PO Token, cookies, client spoofing) to avoid datacenter blocks. Uses Groq AI + JioSaavn for accurate metadata & album art, and embeds lyrics natively into ID3 tags. ⚑

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors