Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
⭐️ Genius.com API client (with lyrics scraper)
Version 2.0 is a complete rewrite with promises and async/await.
yarn add lyricist
or
npm install lyricist --save
Get an access token at https://genius.com/api-clients.
import Lyricist from 'lyricist';
const lyricist = new Lyricist(accessToken);
Use song()
to fetch a song by ID:
const song = await lyricist.song(714198);
console.log(song.title);
// output: Death with Dignity
lyricist.song(714198).then(song => console.log(song.title));
Note: The rest of the examples use async/await for readability.
The Genius API doesn't offer lyrics, but Lyricist can scrape Genius.com for you. Simply provide the fetchLyrics
option like this:
const lyrics = await lyricist.song(714198, { fetchLyrics: true });
// output: Spirit of my silence I can hear you...
Use album()
to look up an album by ID. The Genius API doesn't allow you to search an album by title, but song() will return an album.id
:
const album = await lyricist.album(56682);
console.log('%s by %s, album.name, album.artist.name);
// output: Lanterns by Son Lux
The Genius API doesn't provide tracklists, but Lyricist can scrape Genius.com and return the tracklist for you. Simply provide the fetchTracklist
option like this:
const album = await lyricist.album(56682, { fetchTracklist: true });
console.log(album.songs);
// output: [{ id: 502102, title: 'Alternate World' }, { id: 267773, title: 'Lost It To Trying' }, ...]
Use artist()
to look up an artist by ID:
const artist = lyricist.artist(2);
console.log(artist.name);
// output: Jay Z
Use songsByArtist()
to list an artist's songs. Example usage:
const songs = lyricist.songsByArtist(2);
songsByArtist()
will show 20 results per page by default, and can be as high as 50.
You can provide options as a second parameter. The available options are:
perPage
: Number (default: 20)page
: Number (default: 1)sort
String: 'title' or 'popularity' (default: 'title')Example:
const songs = await lyricist.songsByArtist(2, { page: 2, perPage: 50 });
Take care when fetching lyrics. Use caching and rate-limit your app's requests as much as possible.
Check the Genius.com API docs for more info.
[2.0.0] - 2015-04-27
FAQs
Fetches song lyrics using the Genius.com API and website.
The npm package lyricist receives a total of 62 weekly downloads. As such, lyricist popularity was classified as not popular.
We found that lyricist demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.