(.*)<\/PRE>/s) {
$out = $1;
} else {
print "Regex Failed for letssingit\n";
return 0;
}
my $doc = " " . encode_entities($hs->parse($out)) . " ";
system("dcop", "amarok", "contextbrowser", "showLyrics", $doc);
return 1;
}
sub sing365_scrape {
my $loc = shift;
$mech->get($loc);
my $current = $mech->content();
my $out;
if ($current =~ m/<\/font><\/a>
'\);(.*)
/s) {
$out = $1;
} else {
print "Regex Failed for sing365\n";
return 0;
}
$out =~ s/\n//sgi;
$out =~ s/
/\n/sgi;
my $doc = " " . encode_entities($hs->parse($out)) . " ";
system("dcop", "amarok", "contextbrowser", "showLyrics", $doc);
return 1;
}
sub actionext_scrape {
my $loc = shift;
$mech->get($loc);
my $current = $mech->content();
my $out;
if ($current =~ m/(.*)/s) {
$out = $1;
} else {
print "Regex Failed for actionext\n";
return 0;
}
$out =~ s/\n//sgi;
$out =~ s/
/\n/sgi;
my $doc = " " . encode_entities($hs->parse($out)) . " ";
system("dcop", "amarok", "contextbrowser", "showLyrics", $doc);
return 1;
}
sub azlyrics_scrape {
my $loc = shift;
$mech->get($loc);
my $current = $mech->content();
my $out = "";
if ($current =~ m/
(.*)\[ www.azlyrics.com<\/a> \]
/s) {
$out = $1;
} else {
print "Regex Failed for azlyrics $loc\n";
return 0;
}
my $doc = " " . encode_entities($hs->parse($out)) . " ";
system("dcop", "amarok", "contextbrowser", "showLyrics", $doc);
return 1;
}
sub l007_scrape {
my $loc = shift;
$mech->get($loc);
my $current = $mech->content();
my $out = "";
if ($current =~ m/print version<\/a>(.*)
The hottest songs from/si) {
$out = $1;
} else {
print "Regex Failed for lyric007\n";
return 0;
}
$out =~ s/\n//sgi;
$out =~ s/
/\n/sgi;
my $doc = " " . encode_entities($hs->parse($out)) . " ";
system("dcop", "amarok", "contextbrowser", "showLyrics", $doc);
return 1;
}
sub songmeanings_scrape {
my $loc = shift;
$mech->get($loc);
my $current = $mech->content();
if ($current =~ m/.* \s*(.*?)\s*<\/td>/si) {
$out = $1;
} else {
print "Regex Failed for songmeanings\n";
return 0;
}
$out =~ s/\n//sgi;
$out =~ s/
/\n/sgi;
my $doc = " " . encode_entities($hs->parse($out)) . " ";
system("dcop", "amarok", "contextbrowser", "showLyrics", $doc);
return 1;
}
sub wearethelyrics_scrape {
my $loc = shift;
$mech->get($loc);
$current = $mech->content();
if ($current =~ m/<\/h3>\n\s*(.*?)\s*<\/p>/si) {
$out = $1;
} else {
print "Regex Failed for wearethelyrics\n";
return 0;
}
$out =~ s/\n//sgi;
$out =~ s/
/\n/sgi;
$doc = " " . encode_entities($hs->parse($out)) . " ";
system("dcop", "amarok", "contextbrowser", "showLyrics", $doc);
return 1;
}
while (1) {
my $message = ;
chomp($message);
if ($message =~ /^configure/) {
system("dcop", "amarok", "playlist", "popupMessage", "This script does not require any configuration.");
} elsif ($message =~ /^fetchLyrics/) {
my @tofetch = split(/ /, $message);
if (querylyrics($tofetch[1], $tofetch[2]) == 0) {
system("dcop", "amarok", "contextbrowser", "showLyrics", " Failed to find any lyrics. ");
}
}
}
sub urldecode {
my $str = shift;
$str =~ s/%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;
return $str;
}