Skip to content

lleans/lyricfind-scrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Lyric Find Scrapper ๐ŸŽน

LyricsFind is free online lyrics database, using simple scrapper PyQuery and Aiohttp to grab lyrics from the free-website.

Option ๐Ÿ’ฝ

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
        )

Function ๐Ÿช›

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 of Track 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 as Track 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 of SongData.

    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). On Track class you can find the available_translation(if it exist) select the language you wanted, pass it on lang as params. It will return you Translation class(identical with SongData 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'
      )

Data Model ๐Ÿ“…

All data model, you can acccess it here ๐ŸŽฏ

Setup ๐Ÿงฉ

If you want to use this on your local machine, download this repo, and make sure you run on virtualenv(it's optional)

  1. Open terminal on the repo just you download, then run ๐Ÿ“š
    pip install -r requirements.txt to install required library
  2. 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 PyPi ? ๐Ÿ

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

Releases

No releases published

Packages

No packages published

Languages