Seems the problem is with the lyricsbox.com site (404 err)
I tried switching to musicsonglyrics.com, and that loks better (tho' my hack is pure screen scraping...)
Could be nice if you get some time to fix it!

____________________________________________________
Update April 19: added yet another lyrics channel... -- allan
____________________________________________________
Update April 26: updated code (incl TK GUI) in node 450914
____________________________________________________
#!/usr/bin/perl -w # polls what's current playing on radio KOIT in San Francisco, # get the lyrics from lyricsbox.com # TODO: (1) make the title search a little fuzzier # (2) search more sites for lyrics # (3) nicer interface? color, scrolling? # ==================================================================== +========== use strict; use LWP::Simple; use URI::Escape; my $nowplay = "http://koit.com/nowplay_data.cfm"; my $lyricsbox = "http://www.lyricsbox.com"; my $lyrics_list = "$lyricsbox/cgi-exe/am.cgi?a=search&p=1&l=artist&s=" +; my $musicsong = "http://www.musicsonglyrics.com"; my $matrix = "http://www.ntl.matrix.com.br"; my ($last_artist,$last_title) = ("",""); my $sleep = 60; # poll once/min select((select(STDOUT), $| = 1)[0]); # autoflush STDOUT my $data; while(1){ while (!($data = get($nowplay))) { print "*"; sleep $sleep; next; +} my ($artist, $title) = $data =~ m|box=(.+) - (.+)&|; for ($title) { s/\W+$//g; s/^\W+//g; } # rm head&trail junk my ($a1,$t1,$a,$t,$r) = (substr($artist,0,1), substr($title,0,1)) +; if ($artist ne $last_artist && $title ne $last_title){ # NowPlaying on KOIT print "\n","-"x50,"\n"; print "[$artist]: [$title]\n\n"; ($last_artist, $last_title) = ($artist, $title); my ($list, $url, $song); my $ly = ""; # Lyrics from lyricsbox? $list = get($lyrics_list.uri_escape($artist)); ($url) = $list =~ m|<A href="([^"]+)">\Q$title\E.*?</A></td>| +i; if ($url) { $song = get($lyricsbox.$url); } if ($song) { ($ly) = $song =~ m|<PRE.*?>(.+)</PRE>|si; } if ($ly) { print "Lyrics: $lyricsbox\n\n $ly\n\n"; next; } else { print "No lyrics: $lyricsbox\n"; } # Lyrics from matrix? ($a, $t) = ($artist, $title); for ($t) { s/\s/_/g; s/\'//g; } foreach my $p ("html/lyrics/$t1", "oldies_list/top/lyrics") { $url = lc("pfilho/$p/${t}.txt"); $ly = get("$matrix/$url"); last if $ly; } if ($ly) { for ($ly) { s/^\s+//; s/\s+$//; } print "Lyrics: $matrix\n\n $ly\n\n"; next; } else { print "No lyrics: $matrix\n"; } # Lyrics from musicsong? ($a, $t) = ($artist, $title); for $r (\$a, \$t) { $$r =~ s/\s//g; $$r = lc($$r); } $url = "$a1/${a}lyrics/$a${t}lyrics.htm"; $song = get("$musicsong/$url"); if ($song) { ($ly) = $song =~ m|<span.*?>(.+)</span>|si; } if ($ly) { for ($ly) { s/^\s+//; s/\s+$//; s/<.*?>//gi; } print "Lyrics: $musicsong\n\n $ly\n\n"; next; } else { print "No lyrics: $musicsong\n"; } } else { print "."; } sleep $sleep; }

-- Allan

===========================================================
As the eternal tranquility of Truth reveals itself to us, this very place is the Land of Lotuses

-- Hakuin Ekaku Zenji

In reply to Re^3: Lyrics for what's playing on radio KOIT (FM 96.5 in San Francisco) by ady
in thread Lyrics for what's playing on radio KOIT (FM 96.5 in San Francisco) by johnnywang

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.