LyricsFind is free online lyrics database, using simple scrapper PyQuery and Aiohttp to grab lyrics from the free-website.
There's an multiple option on Search
class. On there you can change the:
-
teritory
iso code e.g 'us'(all lower) (optional)
The usage of this params is, to limit yourself based on country you are( the default value is by searching your ip location)from LyricsFindScrapper import Search session = #your http client client: Search = Search( session=session, teritory='us' )
-
limit
use in params (optional)
You can change the limit request to service. Defaulting on 10, just be mindful what you do.from LyricsFindScrapper import Search session = #your http client client: Search = Search( session=session, limit=10 # Be mindful what you change, bigger number may cuase you're being blocked by server )
There are a few funstions that usable as:
-
get_tracks(query: str)
query as params(type str)
Just like on the website, you can search an multiple tracks by using the query/title/artist/etc. This will return multiple list ofTrack
class.from LyricsFindScrapper import Search, Track session = #your http client client: Search = Search(session=session) #Make sure you're on async func. #Getting tracks e.g tracks: list[Track] = client.get_tracks( query=#Your song title )
-
get_track(trackid: str)
query as params(type str)
Find sepcific track based on metdata. Will return asTrack
class.from LyricsFindScrapper import Search, Track session = #your http client client: Search = Search(session=session) #Make sure you're on async func. #Getting track e.g track: Track = await client.get_track(trackid=f'lfid:{tracks[0].lfid}')
-
get_lyrics(track: Track)
track as params(type Track)
The tracks that you already got, pass it here to get the lyrics. This will return class ofSongData
.from LyricsFindScrapper import Search, Track, SongData session = #your http client client: Search = Search(session=session) #Make sure you're on async func. #Getting tracks e.g tracks: list[Track] = client.get_tracks( query=#Your song title ) #Getting lyrics e.g lyrics: SongData = client.get_lyrics( track=tracks[0] )
-
get_translation(track: Track, lang: str)
tracks and lang as params(type Track and str)
Sometime LyricFind will provide the translation of the lyrics(if it exist. Check on their website). OnTrack
class you can find theavailable_translation
(if it exist) select the language you wanted, pass it onlang
as params. It will return youTranslation
class(identical withSongData
only few changes).from LyricsFindScrapper import Search, Track, SongData session = #your http client client: Search = Search(session=session) #Make sure you're on async func. #Getting tracks e.g tracks: list[Track] = client.get_tracks( query=#Your song title ) #Getting lyrics e.g lyrics: SongData = client.get_lyrics( track=tracks[0] ) #Getting Translation e.g translation: Translation = client.get_translation( track=tracks[0], lang='en' )
All data model, you can acccess it here ๐ฏ
If you want to use this on your local machine, download this repo, and make sure you run on virtualenv(it's optional)
- Open terminal on the repo just you download, then run ๐
pip install -r requirements.txt
to install required library - Then read and run it(dont mind the error, it's just for example) ๐
press f5 if you on vscode
python demo.py
if you using terminal
about that, if you wanted to install this repo as library search on google pip install from github, currently i dont wanna this published on PyPi i just wanna keep this humble on underground library, let's see if i need it to published later