Skip to content

Latest commit

 

History

History
70 lines (61 loc) · 1.34 KB

README.md

File metadata and controls

70 lines (61 loc) · 1.34 KB

pylyrical_api

pylyrical_api - lyrics API scraping from genius.com

API Token

To self-host, you need to get an API token from the api client page. You can then add the API token to a ".env" file. Example: GENIUS_API_TOKEN="T0K3N"

Usage

  • API endpoint: /lyrics
  • Acceptable parameters: q
    • Example: /lyrics?q=how+do+i+make+you+love+me+the+weeknd

Responses

  • 200
{
    "artists": "",
    "lyrics": "",
    "source": "",
    "status": "200",
    "title": ""
}
  • 400
{
    "exception":
    "NoParameter",
    "message": "Missing parameter 'q'.",
    "status": "400"
}
  • 404
{
    "exception": "NoResults",
    "message": "'' did not give any results, Please try a different term.",
    "status": "404"
}
  • 500
{
    "exception": "ScrapeError",
    "message": "",
    "status": "500"
}
  • 502
{
    "exception": "RequestConnectionError",
    "message": "",
    "status": "502"
}

Exceptions/Errors

  • NoParameter: Occurs when no parameter was given.
    • Returns status code 400.
  • NoResults: Occurs when no results were found.
    • Returns status code 404.
  • ScrapeError: Occurs when pylyrical cannot scrape lyrics from genius.com
    • Returns status code 500.
  • RequestConnectionError: Occurs when pylyrical cannot send a request to genius.com
    • Returns status code 502.