Skip to main content

Get Lyrics for any songs by just passing in the song name (spelled or misspelled) in less than 2 seconds using this awesome Python Library.

Project description

Lyrics Extractor Python Library

You can now get lyrics for a song just by passing in the song name without passing an artist name and this library will do the rest of the job for you.

It fetches, extracts and returns the song's title and song lyrics from various websites autocorrecting the song names for the misspelled names along the way.

Motivation

While I was searching for a Python library to extract lyrics for songs to integrate it into my WhatsApp and Slack chatbot, I couldn't find any libraries or APIs which could only accept song names. The APIs and libraries I tested required the accurate spelling of song names and artist name to be passed in for fetching the song lyrics. And even after passing all of these information, there were still some song lyrics which weren't available in their APIs and libraries.

This is the reason why I had to write an algorithm for fetching and scraping song lyrics from various websites even for any misspelled song name passed-in by the user.

Installation

pip install lyrics-extractor

Requirements

How to Use

  1. Import this module in your Python program.

    from lyrics_extractor import SongLyrics
    
  2. Assign a Variable to the Class by passing in the Google Custom Search JSON API key and Engine ID received after creating a custom search engine.

    extract_lyrics = SongLyrics(GCS_API_KEY, GCS_ENGINE_ID)
    

    Replace 'GCS_API_KEY' and 'GCS_ENGINE_ID' with the API key and Engine ID received.

  3. Get the title and the lyrics for the song by passing in the song name in the class function.

    data = extract_lyrics.get_lyrics("Shape of You")
    
  4. If you got the title and the lyrics for the song correctly then change the song name 'Shape of you' and try again with any misspelled song name like 'Shaep fo you'.

  5. Voila! You have received your requested song lyrics even after passing in a misspelled song name.

How to Contribute

  1. Fork this repository.
  2. Clone it onto your local machine and test if everything works correctly before making any changes.
  3. Make the appropriate changes.
  4. Test it.
  5. Test it again.
  6. If everything's fine, open a pull request.

We will be more than happy to review your Pull Requests. So go for it and contribute to this awesome open source community.

If your Pull Request is accepted, you will surely get credits here.

Contributors

Copyright Information

I have only been extracting lyrics for Educational Purposes. The chatbots I mentioned at the start are all being used for Non-commercial Purposes.

If you are planning to use this library for commercial purposes then do have a look at the terms and privacy policies of these websites and scrape lyrics only from sites which allow their content to be scraped and used commercially.

At the end I would say do respect the website's servers and please don't bombard with a lot of requests at once, else you are bound to get an error.


If you liked this Repository, then please leave a star on this repository so that I can know you liked this project. It motivates me to contribute more in such Open Source projects in the future.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lyrics_extractor-3.0.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

lyrics_extractor-3.0.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file lyrics_extractor-3.0.1.tar.gz.

File metadata

  • Download URL: lyrics_extractor-3.0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for lyrics_extractor-3.0.1.tar.gz
Algorithm Hash digest
SHA256 4706717befe00e75e33b28a43aee1f3db080e405788d3c17832b9a0cb37698eb
MD5 b9709e88140ab7269271a96bffad9c03
BLAKE2b-256 8e106afc0b714130a9b2074ab4e07c12c5e11c8dc4d37f98cd143ca660bf3c5e

See more details on using hashes here.

File details

Details for the file lyrics_extractor-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: lyrics_extractor-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for lyrics_extractor-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3c1b597a63f939464f33869ded83a00d2d2f03cd22e9787b5382f3c2bcd0cad
MD5 c77b6db72d3915dce7134d1eefc7784b
BLAKE2b-256 6fd92070c94953375bcd9d9a3e0f7f15b94c4b7a54d84898098a5154ea476f7e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page