A Flask-based lyrics API for plain and timestamped lyrics, metadata, sentiment analysis, trending charts, and multi-source fallback. The current app version is 1.3.0.
- Public endpoints do not require authentication.
- Admin and management endpoints require
ADMIN_KEY. - Optional API tokens are only used for third-party sources.
- Cookie-based YouTube auth is not required by default.
- This is the Flask version. If you want the FastAPI version, visit: https://github.com/Wilooper/LyricaV2.git
- Multi-Source Lyrics Retrieval โ Aggregates from 7 active sources with intelligent fallback and validation
- Timestamped Lyrics (LRC) โ Synchronized lyrics with millisecond precision from multiple sources
- Mood & Sentiment Analysis โ Sentiment detection and word frequency analysis
- Rich Metadata โ Song cover art, duration, genre, release date, and artist info
- Smart Caching โ TTL-based caching (24-hour default) to reduce external API calls
- Rate Limiting โ 15 requests/minute per IP
- Fast Mode โ Parallel fetching for sub-second response times
- Proxy Rotation โ Thread-safe, round-robin rotating proxy pool with failure cooldown and auto-masking credentials
- User Configuration โ INI-based configuration (
.lyrica.config) supporting hot-reloads and environment overrides - Trending Charts โ Real-time trending songs by country via Apple Music
- Analytics & Auto-complete โ Search suggestions via MusicBrainz and top query metrics
- Admin Tools โ Cache, config, and proxy pool management endpoints
- Comprehensive Logging โ Debug and monitor with detailed request/response logs
- Made in India ๐ฎ๐ณ โ Optimized for Indian music platforms (JioSaavn integration)
- Proxy Pool & Rotation API โ Rotate through proxies with custom schemes (
http,https,socks5) - INI Configuration System โ Hot-reloadable
.lyrica.configfile to configure rates, cache, and defaults - Health Check Endpoint โ
/healthendpoint to monitor API status and version info - Apple Music / Suggestion Upgrades โ Autocomplete suggestions via MusicBrainz and analytics queries
- Robust Async Client Migration โ Ported internal fetchers to
httpxasync clients for concurrent racing
| ID | Source | Lyrics Type | Notes |
|---|---|---|---|
| 1 | Genius | Plain | Requires GENIUS_TOKEN |
| 2 | LRCLIB | Timestamped + Plain | Free, very reliable |
| 3 | YouTube Music | Timestamped + Plain | 3-layer fallback (ytmusicapi โ transcript-api โ yt-dlp) |
| 4 | NetEase | Timestamped (LRC) | Via syncedlyrics, large catalog |
| 5 | Megalobiz | Timestamped (LRC) | Via syncedlyrics, user-contributed |
| 6 | Musixmatch | Timestamped (LRC) | Via syncedlyrics, optional MUSIXMATCH_TOKEN |
| 7 | SimpMusic | Timestamped + Plain | Via api-lyrics.simpmusic.org |
- Python 3.12 or higher
- pip (Python package manager)
- Git
# 1. Clone the repository
git clone https://github.com/Wilooper/Lyrica.git
cd Lyrica
# 2. Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Create .env file
cp .env.example .env
# Edit .env and fill in your GENIUS_TOKEN
# 5. Run the server
python run.pyAccess the API at: http://127.0.0.1:9999
- Web GUI:
http://127.0.0.1:9999/app - API Info:
http://127.0.0.1:9999/
# Build image
docker build -t lyrica .
# Run container
docker run -p 9999:9999 \
-e GENIUS_TOKEN=your_token \
-e ADMIN_KEY=your_key \
lyricaLyrica uses a two-tier configuration system: environment variables for system deployment (securities, directories), and an optional .lyrica.config INI file for user/application level settings.
Create a .env file in the project root:
# Secure key to protect admin/management endpoints
ADMIN_KEY=your_secure_admin_key_here
# Genius API client token (Optional, source 1)
GENIUS_TOKEN=your_token
# Musixmatch client token (Optional, source 6)
MUSIXMATCH_TOKEN=your_token
# Rate limiting storage backend (Recommended: redis://... in production)
RATE_LIMIT_STORAGE_URI=memory://
# Caching and log levels
LOG_LEVEL=INFO
CACHE_TTL=86400
CACHE_DIR=cache_dataFor fine-grained control over fetchers, proxy pools, and rate limits, copy .lyrica.config.example to .lyrica.config in your project root or home directory.
Features:
- Default settings: Override default request params like
fast,timestamps,mood,metadata, or the fetchersequence. - Proxy rotation: Paste list of socks5/http proxies under
[proxies]for round-robin rotation. - Rate limits: Configure requests-per-minute (RPM) limits for each fetcher to avoid IP bans.
- Hot Reloading: Config can watch for changes or be reloaded dynamically via
/config/reload.
See .lyrica.config.example for detailed fields.
| Variable | Required | Default | Description |
|---|---|---|---|
ADMIN_KEY |
No | โ | Secure key to access admin and management endpoints (e.g. /admin/cache/clear, /config/reload) |
GENIUS_TOKEN |
No* | โ | Genius API token โ needed for Genius fetcher. Get at genius.com/api-clients |
MUSIXMATCH_TOKEN |
No | โ | Musixmatch API token for Musixmatch fetcher |
RATE_LIMIT_STORAGE_URI |
No | memory:// |
Storage backend for rate limiting (e.g. redis://...) |
LOG_LEVEL |
No | INFO |
Logging level: DEBUG, INFO, WARNING, ERROR |
CACHE_TTL |
No | 86400 |
Cache time-to-live in seconds |
CACHE_DIR |
No | cache_data |
Directory for cache files |
* Lyrica still works without Genius or Musixmatch tokens โ these sources will simply be skipped.
- Push repository to GitHub
- Create new Web Service on Render
- Set build command:
pip install -r requirements.txt - Set start command:
gunicorn -w 4 -b 0.0.0.0:9999 run:app - Add environment variables in dashboard
- Deploy
# Run with 4 workers
gunicorn -w 4 -b 127.0.0.1:9999 --timeout 120 run:app
# Configure Nginx as reverse proxy (see deployment guides)- If you don't want to self-host, you can use the prehosted server. All endpoints are the same as on localhost.
- Link 1: https://test-0k.onrender.com/
- Link 2 (Recommended for production): https://wilooper-lyrica.hf.space/
- The Hugging Face version is designed to handle thousands of simultaneous users with ~95% uptime.
curl "http://127.0.0.1:9999/lyrics/?artist=Arijit%20Singh&song=Tum%20Hi%20Ho"curl "http://127.0.0.1:9999/lyrics/?artist=Arijit%20Singh&song=Tum%20Hi%20Ho×tamps=true"curl "http://127.0.0.1:9999/lyrics/?artist=Arijit%20Singh&song=Tum%20Hi%20Ho&mood=true"curl "http://127.0.0.1:9999/lyrics/?artist=Arijit%20Singh&song=Tum%20Hi%20Ho&metadata=true"curl "http://127.0.0.1:9999/lyrics/?artist=Arijit%20Singh&song=Tum%20Hi%20Ho&fast=true×tamps=true&mood=true&metadata=true"curl "http://127.0.0.1:9999/trending/?country=IN&limit=10"curl "http://127.0.0.1:9999/suggestion?q=Tum%20Hi%20Ho&limit=5"- Verify artist and song names are correct
- Check internet connection
- Try a popular song first to verify the server is working
- Use
fast=trueto run sources in parallel for better coverage
- Regenerate token at genius.com/api-clients
- Verify token in
.env - The API works without Genius โ other sources will be tried
- YouTube Music fetcher runs a robust 3-layer fallback system (ytmusicapi โ transcript-api โ yt-dlp subtitles) which does not require cookies out of the box!
- If your IP gets rate-limited by YouTube, set up the proxy pool in
.lyrica.configto rotate requests.
- The local server limits clients to 15 requests per minute per IP.
- Cache results or configure a Redis backend using
RATE_LIMIT_STORAGE_URIfor higher limits.
Edit run.py:
if __name__ == '__main__':
app.run(port=8080, debug=True) # Change 9999 to 8080- Full API Reference: See USER_GUIDE.md
- Setup Details: See SETUP_GUIDE.md
- Issues: Open GitHub issues for bugs or feature requests
Contributions are welcome!
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
Please ensure:
- Code follows PEP 8 style guide
- Documentation is updated for any new or changed features
- Commit messages are descriptive
You can also suggest changes by opening an issue โ all suggestions are welcome!
MIT License ยฉ 2025 Lyrica Contributors
See LICENSE file for details.
|
Shaurya singh |
Romain Batigne |
Shelbee Johnson |
- sigma67 โ ytmusicapi
- tranxuanthang & LrcLib Team โ LRC lyrics support
- maxrave-dev โ SimpMusic integration
- JioSaavn โ Music metadata and streaming
- syncedlyrics โ NetEase, Megalobiz, Musixmatch integration
- MusicBrainz โ Song suggestion/autocomplete data
- Documentation: USER_GUIDE.md
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: thinkelyorg@gmail.com
Current Version: 1.3.0
Reference: GitHub release metadata and the current API health response
Made with โค๏ธ in India ๐ฎ๐ณ