LyricsFinder is a modular and easily expandable Python Package that is used to extract lyrics from music. By having the ability to use a combination of a Google Custom Search Engine and a set of extractors for several sources, lyrics are attained with much higher accuracy and generally from the best desired source.
Python 3.6+ with
[Strongly Recommended]: A Google Developer API Key with the 'Custom Search' API enabled. This link should take one there once logged in.
Note: While the Google tools aren't technically required for this project, much of the beneficial functionality depends on such keys/search engines. However, direct searching/parsing from a supported URL source is possible to incorporate with this package, though not the recommended way to utilize it (unless one requires a specific application requirement/design need).
The following modules will be automatically downloaded and installed as part of the standard setup:
sudomay be required to install depending on your system setup. If any permission errors occur, please use the sudo flags.
This package can easily be installed with one of
pip install lyricsfinder # if pip matches Python 3.6+pip3 install lyricsfinder # if pip3 matches Python 3.6+
pip version matches that of Python.
Many systems will allocate
pip3 to Python 3.x+, so
pip3 can be used if your system has this installed. (
pip will, in this case, be associated with Python 2.7.x)
Alternatively, you can install directly (ensure
python3 --versionis 3.6 or greater):
python3 -m pip install -U https://github.com/GieselaDev/LyricsFinder/archive/master.zip
From Source (slower/manual way):
$ git clone https://github.com/GieselaDev/LyricsFinder.git$ cd LyricsFinder$ python3 -m pip install .
Testing the package (optional):
You may use
pytest to test the package.
You can now import the package
lyricsfinder as normal within your project.
import lyricsfinderlyrics = lyricsfinder.search_lyrics("Dusk till Dawn", google_api_key="api key")
lyrics is a
Lyrics instance (see below).
LyricsFinder is designed with expandability in mind. The following is a very brief structure of the project:
Extractor for animelyrics.com
Extractor for azlyrics.com
Extractor for genius.com
Extractor for lyricsmode.com
Extractor for lyrical-nonsense.com
Extractor for musixmatch.com
Results can be stored in JSON format to cache by using
json.dump on the dict that is returned by calling
The following contains the base model for the Lyrics Object -- within it we have our class structures for the
Lyrics classes, which we discuss below.
LyricsOrigin model class contains the following attributes:
Lyrics model class contains the following attributes:
lyrics contain newline parsed lyrics, the
origin contains the
query which was searched for, the
source_name from one of the listed sources in the above chart (such as Genius), the
source_url which contains the base URL of the source, and the
url contains the direct link for the track lyrics on the given source. The
timestamp is a standard UNIX timestamp from the request time and the
title is the parsed title of the track in question.
Please see the example of an implementation of this at the bottom of this README.
Some current implementations:
Giesela -- a unique music suite and player for Discord.
An example of the live implementation of GiTils' lyrics blueprint from the source in action: https://gitils.giesela.io/lyrics/substance%20therapy
Lyrics are cached in MongoDB for faster loading in this implementation.
[IMPORTANT] Please note that the above live example is not for large-scale use; the public API is monitored and rate limited to prevent abuse. If you wish to host your own version, the GiTils package linked above is the implementation of the API (along with other utilities).
Please feel free to open any issues on GitHub for questions and/or support. We're happy to help!