Lyrics::Fetcher::LyricsTranslate - Get lyrics from lyricstranslate.com
# This module should be used directly use Lyrics::Fetcher::LyricsTranslate; print Lyrics::Fetcher::LyricsTranslate->fetch('Lyube', 'Kombat'); # Equivalent to print Lyrics::Fetcher::LyricsTranslate->fetch('Lyube', 'Kombat', 'English'); # Equivalent to print Lyrics::Fetcher::LyricsTranslate->fetch('Lyube', 'Kombat', 328); print $Lyrics::Fetcher::LyricsTranslate::LANGUAGES{English}; # prints 328 # Can also be used via Lyrics::Fetcher but produces ugly output and # does not support a custom target language use Lyrics::Fetcher; print Lyrics::Fetcher->fetch('Lyube', 'Kombat', 'LyricsTranslate');
This module tries to get translated lyrics from http://lyricstranslate.com. It searches for a translation of the given artist and song title from any language to a requested language (which defaults to English), and returns the contents of the first result found.
It is recommended to use the module directly, as using it via Lyrics::Fetcher loses empty lines between parahraphs.
The target language can be specified as either a number or a string. If a string is given, it is looked up in the hash %Lyrics::Fetcher::LyricsTranslate::LANGUAGES which maps language names to their numerical identifiers. The hash was generated from the website, and it might be outdated.
%Lyrics::Fetcher::LyricsTranslate::LANGUAGES
The target language is passed as the third argument to the fetch method. If using the module via Lyrics::Fetcher, the target language cannot be set and defaults to English.
Lyrics::Fetcher, http://lyricstranslate.com
Marius Gavrilescu, <marius@ieval.ro>
Copyright (C) 2016-2017 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.0 or, at your option, any later version of Perl 5 you may have available.
To install Lyrics::Fetcher::LyricsTranslate, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lyrics::Fetcher::LyricsTranslate
CPAN shell
perl -MCPAN -e shell install Lyrics::Fetcher::LyricsTranslate
For more information on module installation, please visit the detailed CPAN module installation guide.