NAME

WebService::SongLyrics - Retrieve song lyrics from www.songlyrics.com

SYNOPSIS

use WebService::SongLyrics;

my $wsl = WebService::SongLyrics->new;

my $lyrics = $wsl->get_lyrics("Beyonce", "Crazy in love");

DESCRIPTION

The WebService::SongLyrics module attempts to scrape song lyrics from http://www.songlyrics.com Due to the nature of screen scraping it's not the most resilient of code.

Thanks to the sites search engine it's a little picky about the phrasing of the song and artist. It especially doesn't like "Artist ft other artist".

EXAMPLES

use WebService::SongLyrics;

my $wsl = WebService::SongLyrics->new;

my $lyrics = $wsl->get_lyrics("Beyonce", "Crazy in love");

print $lyrics, "\n" if $lyrics;

METHODS

new ( chart => 'chart type' )

This is the constructor for a new WebService::SongLyrics object. It takes no arguments and simply returns a new instance.

get_lyrics ( $artist, $song_title )

The get_lyrics method requires both an artist and a song title and returns the lyrics for the given combination. If it can find them.

It returns undef if you fail to pass in either parameter or if it can't find the lyrics. It dies with a short message and the URL if the server can't be found or it gets a HTTP status code that indicates failure.

NOTES

I originally planned to release this under the Lyrics::Fetch namespace but after spending some time digging through the (very limited) docs and descriptions I thought it'd be better to do it as a stand-alone module.

The namespace is a little pretentious but it does fit with the other WebService::DomainName modules already on CPAN.

DEPENDENCIES

WebService::SongLyrics requires the following modules:

LWP::UserAgent

URI::Escape

LICENCE AND COPYRIGHT

Copyright (C) 2006 Dean Wilson. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Dean Wilson <dean.wilson@gmail.com>