Yuita A. Sari

“If you want to be a writer, you must do two things : read a lot and write a lot. There's no way around these two things that I'm aware of, no shortcut.” ― Stephen King

Strawberry Perl : Retrieving Lyrics Music From LyricWiki

Leave a comment

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 :

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
}

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s