npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

genius-scraper

v1.0.3

Published

a nodejs module to use to scrape lyrics from Genius + wrap the API

Downloads

1

Readme

genius-scraper

A node.js module that can be used in a backend to pull Genius API information with less bloat, and can be then used to scrape lyrics from Genius.

:link: Dependencies

:computer: Installation

npm install genius-scraper

:book: Usage

Currently supplies three functions to interact with the Genius API/scrape lyrics.

getArtist(accessToken, artistName, fullObject = false)

Requires a Genius API access token. Pass the token and the artist name. If fullObject is true, it returns the full API object response from Genius, otherwise returns a small object in the format:

{
  name: "Britney Spears",
  id: 1052
 }

This function utilizes the Genius API endpoint at https://api.genius.com/search; the endpoint returns an object with the first 10 hits related to your search query (i.e., artistName). If any of the returned hits contain a primary artist name that matches the artistName parameter, this artist name and ID will be returned. If none of the primary artist names match the search query, then every artist name and ID will be returned as an array of objects. If no hits are found, null is returned.

getSongs(accessToken, artistID, fullObject = false)

Requires a Genius API token. Pass the token and an artist ID (can be obtained using getArtist). If fullObject is true, it returns an array of the full API object response from Genius for each song, otherwise returns an array of small objects representing each song by the artist in the format:

{
 title: "...Baby One More Time",
 id: 78169
 url: "https://genius.com/Britney-spears-baby-one-more-time-lyrics"
}

getLyrics(url)

Does not require a Genius API token. Pass a string containing the full URL for a Genius lyrics page. It will return a string containing the full lyrics for that song, formatted with new lines. If no lyrics are found at the given URL, it will return null.

:beers: License

genius-scraper is provided for free under the MIT license.