Skip to content

FantoX/lyrics-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The simplest yet most powerful Genius Lyrics scrapper


CodeFactor


Description:

  • This is a Scraper which can scrap and give you lyrics of any song that's available on Genius Offitial Site.
  • This can return both album thumbnail and lyrics if they are available through thw power of web scraping.
  • Scraping an website is not always allowed by the website owners. This project is made for educational purposes only.

Whats New on version 3.0.1

  • Added ES6 Javascript and Typescript Support
  • Updated code according to updated Genius Lyrics page HTML
  • Added JS Doc for more clear implementation
  • Added support for promises too
  • Removed backwards compatibility for older version of this package (Use npm i @fantox01/lyrics-scraper@latest to update)

Installation:

npm i @fantox01/lyrics-scraper
yarn add @fantox01/lyrics-scraper

Usage:

  • For ES5 Javascript
const getLyrics = require("@fantox01/lyrics-scraper");

const main = async () => {
  const data = await getLyrics("Heat Waves");
  console.log(data);
};
main();

  • For ES6 Javascript / Typescript
import { getLyrics } from "@fantox01/lyrics-scraper";

const main = async () => {
  const data = await getLyrics("Heat Waves");
  console.log(data);
};
main();

Output:

  • It will automatically format the lyrics and add new lines ("\n").
  • Use console.log(data.lyrics) to for only lyrics and console.log(data.thumbnail) to get only thumbnail.
{
  status: 200,
  url: 'https://genius.com/Glass-animals-heat-waves-lyrics',
  album: 'Heat Waves by Glass Animals',
  artist: 'Glass Animals',
  release_date: 'June 29, 2020',
  thumbnail: 'https://images.genius.com/25ffad8f4a6804e3efc869253f030baf.1000x1000x1.jpg',
  lyrics: '[Intro]\n' +
    '(Last night, all I think about is you)\n' +
    "(Don't stop, baby, you can walk through)\n" +
    "(Don't want, baby, think about you)\n" +
    "(You know that I'm never gonna lose)\n" +
    "Road shimmer wigglin' the vision\n" +
    "Heat, heat waves, I'm swimmin' in a mirror\n" +
    "Road shimmer wigglin' the vision\n" +
    "Heat, heat waves, I'm swimmin' in a—\n" +
    '\n' +
    '[Chorus]\n' +
    'Sometimes, all I think about is you\n' +
    'Late nights in the middle of June\n' +
    "Heat waves been fakin' me out\n" +
    "Can't make you happier now\n" +
    'Sometimes, all I think about is you\n' +
    'Late nights in the middle of June\n' +
    "Heat waves been fakin' me out\n" +
    "Can't make you happier now\n" +
    '\n' +
    '[Verse 1]\n' +
    "Usually, I put somethin' on TV\n" +
    'So we never think about you and me\n' +
    'But today, I see our reflections clearly\n' +
    "In Hollywood, layin' on the screen\n" +
    'You just need a better life than this\n' +
    "You need somethin' I can never give\n" +
    'Fake water all across the road\n' +
    "It's gone now, the night has come, but\n" +
    '\n' +
    '[Chorus]\n' +
    'Sometimes, all I think about is you\n' +
    'Late nights in the middle of June\n' +
    "Heat waves been fakin' me out\n" +
    "Can't make you happier now\n" +
    '\n' +
    '[Verse 2]\n' +
    "You can't fight it, you can't breathe\n" +
    "You say somethin' so lovin', but\n" +
    'Now I gotta let you go\n' +
    "You'll be better off in someone new\n" +
    "I don't wanna be alone\n" +
    'You know it hurts me too\n' +
    'You look so broken when you cry\n' +
    'One more and then I say goodbye\n' +
    '\n' +
    '[Chorus]\n' +
    'Sometimes, all I think about is you\n' +
    'Late nights in the middle of June\n' +
    "Heat waves been fakin' me out\n" +
    "Can't make you happier now\n" +
    'Sometimes, all I think about is you\n' +
    'Late nights in the middle of June\n' +
    "Heat waves been fakin' me out\n" +
    "Can't make you happier now\n" +
    '\n' +
    '[Bridge]\n' +
    "I just wonder what you're dreamin' of\n" +
    'When you sleep and smile so comfortable\n' +
    'I just wish that I could give you that\n' +
    "That look that's perfectly un-sad\n" +
    'Sometimes, all I think about is you\n' +
    'Late nights in the middle of June\n' +
    "Heat waves been fakin' me out\n" +
    "Heat waves been fakin' me out\n" +
    '\n' +
    '[Chorus]\n' +
    'Sometimes, all I think about is you\n' +
    'Late nights in the middle of June\n' +
    "Heat waves been fakin' me out\n" +
    "Can't make you happier now\n" +
    'Sometimes, all I think about is you\n' +
    'Late nights in the middle of June\n' +
    "Heat waves been fakin' me out\n" +
    "Can't make you happier now\n" +
    '\n' +
    '[Outro]\n' +
    "Road shimmer wigglin' the vision\n" +
    "Heat, heat waves, I'm swimmin' in a mirror\n" +
    "Road shimmer wigglin' the vision\n" +
    "Heat, heat waves, I'm swimmin' in a mirror"
}

Making of @fantox01/lyrics-scraper

How?

  • Using Axios and Cheerio
  • Axios - A promise based HTTP client for the browser and node.js
  • Cheerio - A fast, flexible, and elegant library for parsing and manipulating HTML and XML.

Why?

  • IDK, scraping is fun to me and also legal upto a limited extend as long as you don't misuse it.

Contributions

  • Made by FantoX
  • I don't have any other contributors in this project yet. Feel free to contribute.

Support me

  • Give this project a 🌟 if you like my project.
  • Please follow me on GitHub to get notified about my upcoming projects.

About

The simplest yet most powerful Genius Lyrics scrapper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published