javascriptgenius-api

Scrape Genius Lyrics


So I have to do a project for school, I need to create a simple website who uses an API. I want to use the genius API to collect the lyrics but you can't because of copyright. I can only use the API to find certain information about a song like creator, url of the cover{image}, or song link (genius). So if I want to get the lyrics I need to scrape the link of the song. I have some problems with scraping because it's usually accomplished with node.js and I can't use node.js because it's not allowed in the project.

Do anybody have an idea how to scrape this link to find the lyrics only with pure javascript (i can also use jQuery): https://genius.com/Lil-peep-white-tee-lyrics

I know that the html page contain a tag and all the lyrics are here.

Example :

<div class="lyrics">
   <p> This is the lyrics</p>
</div>

If anybody has an idea it would be very helpful. Thanks


Solution

  • The problem you are running into is actually a fairly common issue in programming. It's easy to underestimate the complexity of a system before getting down to implementing it, or to find that a platform is not capable of handling the task you need it to. In these cases, you need to be able to do one of two things, either redefine the system you're building, or expand the framework you're building it on.

    You said this is for a school assignment where the objective is to consume an api. My first step would be to talk to your instructor to see if the project's goals can be redefined to only include the information provided through the api. If getting the lyrics is required, the next attempt should be to find an api that can provide them like this one. https://developer.musixmatch.com/plans.

    Scraping webpages should be the last resort.