Use Genius Lyrics API with ease

This library provides you with a nice interface to Genius API. It's not an official Genius product.

All the available API documentation is copied and adapted into comments for you to see the usage of classes/methods right from an IDE.

All the API-related classes are prefixed with GeniusApi.

Classes

Core classes

  • GeniusApiOptions allows you to configure method calls.
  • GeniusApiTextFormat is the requested server response format.
  • GeniusApiResponse contains the response of a successful method call.
  • GeniusApiException will be thrown when http status code differs from 2xx.

Main API classes

  • GeniusApiAuth allows you to get an accessToken, both on server or client.
  • GeniusApiRaw provides all the other officially documented methods.
  • GeniusApi is basic abstract API class that you can extend to write your own implementations.

Plans

I'm planning to add some more Genius API implementations in the future (like GeniusApiRawExtended or GeniusApiWrapped).

There's what I think I will eventually add in new implementations:

For now the library only provides the comprehensive interface to Genius API through the GeniusApiRaw implementation, nothing more.

Usage

Each method is documented fairly well and has pretty the same parameters, as listed in the official API doc.

You can find usage examples for each of them in tests folder.

A simple usage example:

final api = GeniusApiRaw(
  accessToken: 'token here',
// Set all methods to return plain text instead of the default dom format.
  defaultOptions: GeniusApiOptions(textFormat: GeniusApiTextFormat.plain),
);

// Get info about song "https://genius.com/Yxngxr1-riley-reid-lyrics".
final res = await api.getSong(4585202);
print(res.data['song']['full_title']); // Outputs "Riley Reid by ​yxngxr1"

Further Reading

Check out the API docs for detailed information about all package members.

Features and bugs

Please file feature requests and bugs at the issue tracker.

For folk seeing this on GitHub

Libraries

genius_api_unofficial
This library provides you with a nice interface to Genius API. It's not an official Genius product. [...]