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

ultra-lyrics

v1.1.1

Published

Lyrics Fetcher

Downloads

82

Readme

Ultra-Lyrics

Ultra-Lyrics is a package which fetches the Genius API and uses the data to scrap the lyrics from the actual website. Occasionally paired with Spotifydl-Core

Read Docs Here: Docs

Install

npm i ultra-lyrics

Usage

Note: To authenticate with a Genius access token, you need to add it to process.env as an ENV Variable or usign dotenv wth the name as GENIUS_ACCESS_TOKEN

Search for songs

import { search } from 'ultra-lyrics'
// const { search } = require('ultra-lyrics')
(async () => {
    const { data, error } = await search('Blue Clapper')
    if (error instanceof Error) console.error('An error occurred', error)
    else console.log('Results', data)
})()

Get Lyrics

import { search, getLyrics } from 'ultra-lyrics'
// const { search } = require('ultra-lyrics')
(async () => {
    let { data: results, error } = await search('Precious Photographs')
    if (error instanceof Error) console.error('An error occurred while searching', error)
    else {
        const { data, error } = await getLyrics(results[0]) // you can also pass the title too
        if (error) console.error('An error occurred while fetching lyrics', error)
        else console.log('Lyrics', data)
    }
})()

Get Song

import { getSong } from 'ultra-lyrics'
// const { search } = require('ultra-lyrics')
(async () => {
    const { data, error } = await getSong('Dreaming Days')
    if (error instanceof Error) console.error('An error occurred', error)
    else console.log('Song', data)
})()

As of right now, ultra-lyrics exports 3 functions. All of them will return a Promise of the object of type UltraLyricsFunctionReturnType. It has 2 Properties, error and data. The error property will contain an instance of the Error class if there was an error. The data property will contain the data returned by the function IF NO ERROR OCCURED. This helps in avoidng the "try-catch hell". Full CreditsJeff Delaney for this idea. Watch this video by fireship for more info: Async Await try-catch hell