A basic CLI lyrics search in Python 3, using the lyrics-extractor library.
Because I spend a lot of time in the terminal, I wanted the most straight-forward way to search for lyrics from the CLI without knowing the exact song name or title, or by searching for some of the lyrics. This script returns the lyrics of the best match for your search terms.
- CLI-only version
- TK GUI version as well
- Library supports flexible input (artist name, title, lyrics)
- Library can handle misspellings
-
Install required required libraries
pip install -r requirements.txt
-
Create Google API key
-
Create Engine ID
See the lyrics-extractor readme for these prerequisites.
-
Modify the script with your API key and Engine ID:
extract_lyrics = SongLyrics(GCS_API_KEY, GCS_ENGINE_ID)
-
If you want to execute the script directly:
chmod +x lyrics.py
-
(Optional) If you want to use the GUI script, install the python3-tk library for your distro (Debian for example):
sudo apt install python3-tk
Search using any combination of artist, title, or lyrics:
python3 lyrics.py artist title lyrics
Or execute directly:
./lyrics.py artist artist title lyrics
Search using song lyrics:
./lyrics.py some song lyrics
Or run without input get a prompt:
./lyrics.py
Lyrics search: