Lyricwiki.org API ban workaround

Lyrics can be fetched again from lyricwiki.org in spite of the ban of the API from major music producers. One more little victory of digital freedom!

Yesterday night I was so frustrated by my widget not working anymore that I had to find a solution. The workaround was very simple indeed: the lyricwiki.org lyrics pages have the author and the song title embedded in the URL of the page, with little or no difference from the previous REST method to access lyrics.

Check out the posts of the dashboard widget and the massive lyrics script for updates: I’m going to fix them soon so that they work again!

The  only difference is that the output is now a full-fledged html page, and not the plain text of the lyrics. To strip the output some more ruby processing is required, basically a call to parse the DOM and extract the node with lyrics, plus some cleanup of the xhtml markup after the node is retrieved. But in more simple words it works again!

Ruby has proven itself again simple, elegant and powerful: look at this one-liner:

doc.root_node.find_first_recursive {|node| node.name == "div" and node.attributes["class"] == "lyricbox"}

It parses the html output and extracts the node with lyrics thanks to REXML, which comes bundles with ruby. Bliss!

Seems that the ban from music producer has little or no effect, unless they will decide to put down the site completely, but that is not likely to happen, fortunately.

Attached Files:

10 responses to “Lyricwiki.org API ban workaround”

  1. Fill the lyrics of your entire iTunes library in one click. | >dade

    [...] I recently found a fantastic website to get lyrics for songs: lyricwiki.org No ads and plenty of lyrics available for free, even for italian artists or pretty unknown songs. I was also pleased to discover that the website offers an handy REST interface to fetch (or upload) lyrics from scripts update: I found a workaround to retrieve the lyrics without the banned lyricwiki API: read more here. [...]

  2. Jack Slater

    I was googling for a workaround for this Lyricwiki issue and stumbled upon your blog :)

    Good job, mate, hope you’ll fix it in foreseeable future and put the script online! Will be checking this page for any progress! Ciao!

  3. dade

    The script has been fixed and packaged as a platypus app! Enjoy :)

  4. Jack Slater

    Call me blind like a mole, but I cant find it anywhere here :-Q
    Tried to read all blog entries with 10x magnifying glass!

  5. Jack Slater

    404 Not Found
    Not Found

    You tried going to http://www.creamdesign.it/blog/blog/wp-content/uploads/2009/07/MassiveLyrics.rb, and it doesn’t exist. All is not lost! You can search for what you’re looking for.

    :-Q

  6. Jack Slater

    Aha! Works now! :) Wonderful piece of code!

    How about wrapping it the way it can be thrown to $HOME/Library/iTunes/Scripts and executed from there? Will be really handy!

  7. Brendan Cazier

    I was looking for an automated solution to solving my obsession with having lyrics for all my songs, and I came to your site very quickly. However, it seems that now LyricWiki doesn’t even let you copy lyrics from the song page on their actual website. So that meant that I couldn’t use your wonderful script.

    However, I was thinking, what if instead of going to the regular page, you directed your script to the “Edit” page for the song?
    So for example, if I want to access the lyrics to the song “I Want You to Want Me” by Cheap Trick, I would have gone to:
    http://lyrics.wikia.com/Cheap_Trick:I_Want_You_To_Want_Me

    However, the way the page is set up now, I can’t even highlight the lyrics there. BUT! If I click the “Edit” button at the top, it takes me to the following page:
    http://lyrics.wikia.com/index.php?title=Cheap_Trick:I_Want_You_To_Want_Me&action=edit

    From there I can actually highlight the text in the text box and copy-paste it into my iTunes.

    Unfortunately, I have very little experience with Ruby, and don’t really know what I would do to modify your script myself. Do you think it would be possible to implement this into your script?

    Thanks!
    Brendan

Leave a Reply