Strawberry Perl : Retrieving Lyrics Music From LyricWiki

What is the PERL Programming? Google please…:) If you are familiar Terminal in Linux platform, you also can use a command line at Windows platform for code this language. But if u wanna more interactive using Perl programming in Windows platform you just have istalled Strawberry PERL.

download it at this link

After install strawberry PERL,check wheter perl has gonna be okay or not with this command line

perl -v

if your strawberry runs well you can see image above.

Well in this case i would like to try PERL Programming for retrieving some lyrics music. So we need web service which contain lyrics, i’ve taken it at http://lyrics.wikia.com/Lyrics_Wiki. I uses some Indonesian lyrics music. In order to get how to use webservice so we have to know about CPAN which is connected with PERL. Learn CPAN more in http://www.perl.org/cpan.html. Then just have install some modules with this code :

  • cpan WebService :: Audioscrobbler

  • cpan Lyrics::Fetcher::LyricWiki

Now you can use your PERL programming for retrieving lyrics based on the artist. You can try this code :

[code language=”java”]
use WebService::Audioscrobbler;
use Lyrics::Fetcher::LyricWiki;
my $ws=WebService::Audioscrobbler->new;
my $artist=$ws->artist(‘Ada Band’);
my @tracks=$artist->tracks;
for my $tracks(@tracks){
$lyric=Lyrics::Fetcher::LyricWiki->fetch($artist->name,$tracks->name);
$filename=$artist->name."-".$tracks->name;
open FILE,">",$filename or die $!;
print FILE $lyric;
close FILE
}
[/code]

Run that code using command line perl (file perl).pl

Now enjoy your corpus lyrics music 🙂

Reference:

  1. (http://win32.perl.org/wiki/index.php?title=Strawberry_Perl)
  2. http://search.cpan.org/~bigpresh/Lyrics-Fetcher-LyricWiki/lib/Lyrics/Fetcher/LyricWiki.pm
  3. http://search.cpan.org/~nilsonsfj/WebService-Audioscrobbler-0.07/lib/WebService/Audioscrobbler.pm
  4. http://perl.about.com/od/packagesmodules/qt/perlcpan.htm
  5. http://lyrics.wikia.com/LyricWiki:SOAP
  6. https://adinu.wordpress.com/

Leave a Reply

Your email address will not be published. Required fields are marked *