Diff: [root] @ ba1504acfcb | faq | css

lyrics update

File: howto/read-song-lyrics [Diff]

diff --git a/howto/read-song-lyrics b/howto/read-song-lyrics
index a605260..b93c0d9 100644
-- a/howto/read-song-lyrics
++ b/howto/read-song-lyrics
@@ -1,31 +1,18 @@
h1. That does not work anymore!

Well, it works, but you'll need JS-enabled browser or rip out the token and use it A hack to get actual page.

The best service I found so far is "lyricsplugin":http://lyricsplugin.com. Its interface is sacral knowledge though. Here it is.

h2. Example


h2. Explanation

Base URI: http://www.lyricsplugin.com/winamp03/plugin/
GET parameter "artist": Artist name, e.g. "Chitlins,%20Whiskey%20%26%20Skirt" (URI encoded!)
GET parameter "title": Song title, e.g. "Increased%20Chances"

Returned is HTML with maybe lyrics.

h2. Script rip contents from State-Of-Art Intellectual Property Protection Technology of LyricWiki.com (Which We Have To Use Because Of Licensing Agreement)

Simple Ruby script that outputs plaintext HTML lyrics:

bc.. % lyrics.rb "The Prodigy" "Omen"

It’s an omen

It’s an omen

p. [http://gist.github.com/343356]

bc. require 'open-uri'
puts open("http://lyrics.wikia.com/#{URI.escape(ARGV[0])}:#{URI.escape(ARGV[1])}").read.scan(%r|<div class='lyricbox'><div class='rtMatcher'>.*?</div>(.*?)<!--|m)[0][0]

Plaintext lyrics are harder:

bc. require 'rubygems'
require 'open-uri'
require 'hpricot'

puts Hpricot.parse(open("http://lyrics.wikia.com/#{URI.escape(ARGV[0])}:#{URI.escape(ARGV[1])}")).at('div.lyricbox').children.select {|a| a.name != "div"}.map {|s| s.to_plain_text}.join("") #.to_plain_text

h2. Links

"HTML":https://github.com/Voker57/scripts/blob/master/lyrics-html and "TXT":https://github.com/Voker57/scripts/blob/master/lyrics-txt scrappers on github.
\ No newline at end of file

By Voker57 on 2011-05-30 21:32:54 +0400 Powered by bitcheese wiki engine