Skip to content

kahunacohen/google-lyrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

google-lyrics

A JavaScript webscraper which tries to get lyrics from a simple google search.

Caveats

  • Proper use of an artist's lyrics in relation to copyright laws is the users' responsiblity. Respect artist's copyrights.
  • Because this is a screen-scraper the parsing of Google's search results is brittle and relies on a specific DOM structure. If you rely on this module, keep an eye out on whether it continues to work.

Install

$ npm install google-lyrics

CLI

The package installs the script google-lyrics into your path, so you can do:

$ google-lyrics -f json "row row row your boat"
google-lyrics "row row row your boat"
[
  "Row, row, row your boat",
  "Gently down the stream",
  "Merrily merrily, merrily, merrily",
  "Life is but a dream",
  "",
  "",
  "Row, row, row your boat",
  "Gently down the stream",
  "Merrily merrily, merrily, merrily",
  "Life is but a dream",
  "",
  "",
  "Row, row, row your boat",
  "Gently down the stream",
  "Merrily merrily, merrily,",
  "",
  "",
  "Row, row, row your boat",
  "Gently down the stream",
  "Merrily merrily, merrily, merrily",
  "Life is but a dream",
  "",
  "",
  "Row, row, row your boat",
  "Gently down the stream",
  "Merrily merrily, merrily, merrily",
  "Life is but a dream"
]

To output text, pass text with the -f option, or don't invoke the script with -f.

As Module

You can also use as a module in another node script:

const { search } = require("google-lyrics");

search("row row row your boat", "json").then(lyrics => console.log(lyrics));

You can also import from google-lyrics getGeneratedSource, which takes a search term as a parameter and returns a promise with the JavaScript generated source from google and parseSource which takes the generated HTML from getGeneratedSource and parses into JSON.

About

Webscraper to get lyrics from google searches

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published