Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

genius-lyrics-api

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

genius-lyrics-api

A package that provides a convenient wrapper around [Genius API](https://genius.com/developers) for searching and scraping song lyrics.It doesn't use any native node dependencies so it should work fine with front-end libraries like ReactJS & React Na

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
468
increased by38.46%
Maintainers
1
Weekly downloads
 
Created
Source

genius-lyrics-api npm version

A package that provides a convenient wrapper around Genius API for searching and scraping song lyrics.
It doesn't use any native node dependencies so it should work fine with front-end libraries like ReactJS & React Native.

Installation

Install with npm

npm install --save genius-lyrics-api

Or install with Yarn

yarn add genius-lyrics-api

Usage

import { getLyrics } from 'genius-lyrics-api';

const options = {
	apiKey: 'XXXXXXXXXXXXXXXXXXXXXXX',  // genius developer access token
	title: 'Blinding Lights',
	artist: 'The Weeknd',
	optimizeQuery: true
};

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

Methods

genius-lyrics-api exposes the following 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. Throws an error if lyrics are not 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 clean `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. Throws an error 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.

Keywords

FAQs

Package last updated on 26 Jan 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc