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 and thus, can be used on the frontend.

  • 2.0.3
  • 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 and thus, can be used on the frontend.

Installation

Install with npm

npm install --save genius-lyrics-api

Or install with Yarn

yarn add genius-lyrics-api

Usage

Get the Genius Developer Access Token

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));

:warning: You may get a CORS block error while testing on localhost. To bypass this, you need to disable Same-Origin Policy in your browser. Follow the instructions here.


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. Returns null if no lyrics 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.

Support

If you find this package useful, hit the ⭐️ button. Cheers!

Keywords

FAQs

Package last updated on 28 Mar 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