genius_api_unofficial 2.0.1 copy "genius_api_unofficial: ^2.0.1" to clipboard
genius_api_unofficial: ^2.0.1 copied to clipboard

This library provides you with a nice interface to Genius API.

example/example.dart

import 'package:genius_api_unofficial/genius_api_unofficial.dart';

Future<void> main() async {
  // Create an auth object to use in client.
  final auth = GeniusApiAuth.client(
    clientId: 'your client_id here from https://genius.com/api-clients',
    redirectUri: 'your redirect_uri here from https://genius.com/api-clients',
  );

  // If you are on a desktop platform (Windows, Linux or MacOS), the browser will be opened
  // with the Genius authentication page.
  // Else you will have to use `constructAuthorize` instead to get the Uri and open it by yourself.
  await auth.authorize(
    scope: GeniusApiAuthScope.values.toList(), // Request all available scopes.
    responseType: GeniusApiAuthResponseType.token, // Get the token directly.
    // responseType: GeniusApiAuthResponseType.code, // Get the code in url to exchange it later.
  );

  // Somehow gotten the token from the Url after the authentication,
  // or you can use the client access token without authenticating users http://genius.com/api-clients
  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"
}
4
likes
120
pub points
43%
popularity

Publisher

unverified uploader

This library provides you with a nice interface to Genius API.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (LICENSE)

Dependencies

enum_to_string, http, meta

More

Packages that depend on genius_api_unofficial