Fetching song lyrics
LyricWiki is an excellent free service providing song lyrics. A la wikipedia for song lyrics. One cool feature is that the site uses nuSOAP to provide a web services interface for fetching lyrics. Wrote a small PHP class with the help of WSF/PHP which will give a simpler interface. Grab it here (make sure to rename it to .php).
Here’s a few method calls,
Getting song of the day should be easy. getSOTD() method returns an array, song title, artist and the lyrics. Let’s just fetch the song and display only the lyrics.
<?php require 'lyricwiki.php'; $lw = new LyricWiki(); $song = $lw->getSOTD(); print $song['lyrics']; ?>
Ok, let’s try to fetch lyrics of a song you know,
<?php require 'lyricwiki.php' $lw = new LyricWiki(); # parameters: artist and the song title print $lw->getSong('iron & wine', 'boy with a coin'); ?>
Hey! Awesome script
Probably a bunch of ppl will find it helpful.
… there was one small detail that might be nice to see different: since the site is named “LyricWiki” (the singluar “lyric” not plural “lyrics”), could the script possibly be changed to be LyricWiki instead of LyricsWiki.
Sean
16 Oct 08 at 9:02 pm
@Sean: Absolutely! Sorry for the typo, just corrected it.
Chintana
21 Oct 08 at 3:46 am
[...] is that the site uses nuSOAP to provide a web services interface for fetching lyrics. I found a user who made a simple class that fetch information from LyricWiki using SOAP specification, but he is using [...]
Fetching music from LyricWiki « nrdLabs
7 Feb 09 at 7:17 pm
You forgot to put the semicolon on “require ‘lyricwiki.php’”.
Kevin López
10 Feb 09 at 5:16 am
@Kevin: doh, corrected. Thanks Kevin.
Chintana
14 Feb 09 at 2:17 pm
I Receive
Fatal error: Class ‘WSClient’ not found
Andrea
19 Jan 10 at 10:53 pm
@Andrea: You have to have WSF/PHP installed. Get it from here – http://wso2.org/projects/wsf/php. Holler if you have any trouble installing it.
Chintana
20 Jan 10 at 8:03 am
i love reading this article. Very good attribute to all info ive read.. //J
Jimmy Eriksson
4 Mar 10 at 7:38 pm
[...] Fetching song lyrics at Engwar – http://engwar.com/post/58 – http://www.GetShawty.com [...]
Horace Vandermeer
15 Mar 10 at 9:18 pm
Thanks for the , I’ll keep checking back for more articles, bookmarked!
Justin Brewington
17 Mar 10 at 12:29 pm
much appreciatedtab seems just like the band
Valerie
31 May 10 at 2:22 pm
sounds pro!
Vicky
31 May 10 at 2:24 pm
That music is really incredible, and I’m not really into that genre! I enjoy listening to it!
Amir Thompson
6 Jun 10 at 9:32 am