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.
So I coded a script to fetch and update the lyrics for the selected songs in iTunes automatically. It cycles through all the selected songs and if it finds the lyrics on lyricwiki it puts them into the corresponding field of the iTunes track. I tested the script on my whole library and – after 5 minutes – most of my tracks had lyrics attached.
For that massive update task I found applescript to be a very quirky programming language. The folks at appscript realized this long before me and coded a ruby binding for the applescript object model.
Ruby was far more intuitive, and definitely replaced the need for applescript.
If you want to run the script you should also have the appscript and the curb (for curl support) gems installed: type this into a terminal to be up and running:
sudo gem install rb-appscript
sudo gem install curb
The script is available for download both as a plain .rb file and as a self-contained application (thanks to platypus)
Usage:
- install the appscript and curb gems (one time)
- open iTunes and select the songs you want to fetch lyrics for.
hint: command-a selects all your library - execute the script:
either launch the application
or runruby MassiveLyrics.rbinside a terminal
If you feel that your iPod hasn’t been the same as before after having all your favorite songs with lyrics, contribute the lyrics they don’t have on lyricwiki.org!

could someone confirm this also works on windows?
[...] have all your songs with lyrics added automatically check out my massive lyrics update script! Have [...]
hey,
i’ve tried installing and get the same error for both appscript and curb:
ERROR: Error installing rb-appscript:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install rb-appscript
can’t find header files for ruby.
do you know what may be the problem here?
unfortunately, i am not familiar with it enough :(
Turns out that you have to install the xcode tools:
just found this and love it. works great with one slightly major issue, but not one that makes it unusable – if the song title (and perhaps artist) has an ampersand “&” in it, the run will crash. Anyway to add a check to either skip those files, or sub it out to “and” in the lookup so that it doesn’t crash the script?
Just fixed it. Thank you for pointing out the error. Tried it with beauty & the beast which had two ampersands, and this time it worked. Check it out (both script and packaged app have been updated)
hey
there’s a problem when using macport’s ruby (and probably any custom ruby build) instead of apple’s one…
problem can be easily fixed by modifying AppSettings.plist and changing
ScriptInterpreter
/usr/bin/ruby
to
ScriptInterpreter
/usr/bin/env ruby
thanks a lot for this handy script :)
Hi,
I’m trying to run the application. I’ve tried installing the curb gems and appscript things in terminal, but it doesnt seem to do much. It asks me for my password in terminal, which i have none for my mac, i press enter, and nothing happens. When i run the application, i get this in the message box
Running…
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’: no such file to load — appscript (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require’
from /Users/mullanj/Downloads/MassiveLyrics 2.app/Contents/Resources/script:25
I’m really unskilled with all this. Can someone help me out?
Thanks =)
Jake, the version of the script is very early, and for now it is suiited for systems that already have a basic set of developer tools installed.
I am working towards a refined 0.2 version, which hopefully will ease away the quirks of this ‘developer’ version. So… stay tuned :)
Well thats good to hear! =)
Thanks a bunch!
[...] pesquisa minha, descobri uma gambiarra que o dade fez e chamou de Massive Lyrics. Em vez de acessar a API de um site, ele acessa diretamente a página com a letra da [...]
Got everything installed but I’m getting this error:
Black_Eyed_Peas:Rock_That_Body
CANNOT FIND any lyrics for Black Eyed Peas – Rock That Body
===============================================================
lyrics already present for 0 song(s)
lyrics not found for 1 song(s)
updated 0 song(s)
for every song without lyrics. When I look at lyricwiki.org I’m getting forwarded to lyrics.wikia.com and I’m able to find the lyrics. But somehow the script seems to fail…
Thanks in advance.
Does this works with windows?
If yes could you tell me how?
thnks!
Hi!
I used your script some time ago.
Now I’m trying to use it, it exits OK, but no lyrics has been updated in iTunes! No files get updated.
Stdout:
[01:43:28] user@station:[~/Downloads]:ruby massivelyrics.rb
“Found: Michael Jackson – Jam”
“Found: Michael Jackson – Why You Wanna Trip On Me”
“Found: Michael Jackson – In The Closet”
“Found: Michael Jackson – She Drives Me Wild”
“Found: Michael Jackson – Remember The Time”
“Found: Michael Jackson – Can’t Let Her Get Away”
“Found: Michael Jackson – Heal The World”
“Found: Michael Jackson – Black Or White”
“Found: Michael Jackson – Who Is It”
“Found: Michael Jackson – Give In To Me”
“Found: Michael Jackson – Will You Be There”
“Found: Michael Jackson – Keep The Faith”
“Found: Michael Jackson – Gone Too Soon”
“Found: Michael Jackson – Dangerous”
“lyrics already present 0″
“updated 14 song(s)”
“not found 0″
Thanks!
I’ve made a few improvements on the script.. here they are:
1. not require curb, using require ‘net/http’ from the standard library
pagecontent = Net::HTTP.get_response(URI.parse(url)).body
2. to handle any special character I convert everything to hex representation
def str_to_url_hex(str)
out = “”
i = 0
while !str[i].nil? do
out += ‘%’ + (“%02s” % str[i].to_s(16)).gsub(‘ ‘,’0′)
i+=1
end
out
end
song = str_to_url_hex(song)
3. the liricswiki website moved to http://lyrics.wikia.com/ and the paged didn’t get parsed correctly… so I modified that too.. it’s a bit hacky so I won’t put it here
thanks for the appscript part, I didn’t know about it!
bye
Hi!
Maybe I’m blind, but I don’t see a link to download “MassiveLyrics.rb” file. Please give a link.
Thanks!
Sorry man, I had to take down the script for maintenance.
Lyricwiki has changed again, and I am struggling to get appscript working again in leopard 10.6… it is just the last step towards a workable script.
Anyway I will reactivate the link on the post, if you or someone else wants to figure out things on its own!