An open API service indexing awesome lists of open source software.

https://github.com/lleans/lyricfind-scrapper

Simple API scrapper on LyricFInd 🎹
https://github.com/lleans/lyricfind-scrapper

api pyquery python3 scrapper

Last synced: about 2 months ago
JSON representation

Simple API scrapper on LyricFInd 🎹

Awesome Lists containing this project

README

          

# 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)

```python
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.

```python
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.

```python
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.

```python
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.

```python
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).

```python
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 🎯](LyricsFindScrapper/model.py)

## 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