Setup
Before we start installing the package, we’ll need to get an access token.
Authorization
First you’ll need to sign up for a (free) account
that authorizes access to the Genius API. After signing up/
logging in to your account, head out to the API section on Genius
and create a new API client. After creating your client, you can
generate an access token to use with the library. Genius provides
two kinds of tokens:
- client access token:
Mostly LyricsGenius is used to get song lyrics and song
info. And this is also what the client access tokens are used for. They
don’t need a user to authenticate their use (through OAuth2 or etc) and
you can easily get yours by visiting the API Clients page and click
on Generate Access Token. This will give you an access token, and
now you’re good to go.
- user token:
These tokens can do what client access tokens do and
more. Using these you can get information of the account you have
authenticated, create web-pages and create, manage and up-vote
annotations that are hosted on your website. These tokens are
really useful if you use Genius’s Web Annotator on your website.
Otherwise you won’t have much need for this. Read more about
user tokens on Genius’s documentation. LyricsGenius has a
Auth class that provides some helpful methods to get
authenticate the user and get an access token.
Installation
lyricsgenius requires Python 3.
Use pip to install the package from PyPI:
Or, install the latest version of the package from GitHub:
pip install git+https://github.com/johnwmillr/LyricsGenius.git
Now that you have the library intalled, you can get started with using
the library. See the Usage for examples.