Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

tobias-lavalink

tobias-inc10MIT1.0.3

Install with npm

readme

tobias-lavalink

Installation

Install with npm

npm install --save tobias-lavalink

Or install with Yarn

yarn add tobias-lavalink

Usage:

Get the Genius Developer Access Token

import { getLyrics } from 'tobias-lavalink';
const options = {
    apiKey: 'XXXXXXXXXXXXXXXXXXXXXXX', // genius developer access token
    title: 'Qq cê tá insinuando',
    artist: 'Sidoka'
};

getLyrics(options).then(lyrics => console.log(lyrics));

Reference:

tobias-lavalink exposes this methods

getLyrics(options)

Automatically get the lyrics from genius.com using the title & artist fields.
Returns a promise that resolves to a string containing lyrics. Returns null if no lyrics are found.

getAlbumArt(options)

Automatically get the albumArt from genius.com using the title & artist fields.
Returns a promise that resolves to a string containing a url. Returns null if no url is found.

getSong(options)

Automatically gets both the lyrics and albumArt from genius.com using the title & artist fields.
Returns a promise that resolves to a object containing the lyrics and the album art url which can be retrieved with object.lyrics and object.albumArt. Object value equals null if no lyrics or urls are found.

Arguments

const options = {
    apiKey: string, // Genius Developer API key/Access Token
    title: string, // Title of the song
    artist: string, // Name of the artist
    optimizeQuery: boolean // Whether to remove redundant words from "title" & "artist" before searching. "false" by default.
};

All properties in the options object are required except optimizeQuery. If either of the title or artist is unknown, pass an empty string as its value.

searchLyrics(options)

Search lyrics from genius.com using the title & artist fields.
Returns a promise that resolves to an array of search results. Returns null if no matches are found.

Receives the same arguments as getLyrics.

getLyricsFromPath(path: string)

Get the lyrics of a song using the path property present in the search results of searchLyrics method.
Returns a promise that resolves to a string containing lyrics.

getAlbumArtFromPath(path: string)

Get the album art url of a song using the path property present in the search results of searchLyrics method.
Returns a promise that resolves to a string containing a url.

Package based in genius-lyrics-api && lavalink