Gotta love that LWP

gnat on 2002-08-17T05:09:56

I spent a few hours tonight knocking up code to milk the Chinese mp3 server that Slashdot pointed to. So while I sleep tonight, my machines will be fetching me hot mp3 action. Not that I'm particularly fond of Brandy's latest album, but it was fun to write the code ...

--Nat


Open source and all that...

darobin on 2002-08-17T16:05:51

So, it's sure nice to know you had fun with LWP but are you going to keep that script to yourself or is there any chance you'll share it with the other nice kids so they don't have to rewrite it? :-)

Gone

vek on 2002-08-18T06:07:18

Blimey, glad I grabbed that Oasis album when I did (grin). I just visited the site and was greeted by a blank page with the following line:

Lmp3 will be closed and will never come back!

Re:Gone

boru on 2002-08-18T17:40:40

The site with the MP3s is still at: http://www.music369.com

Re:Gone

bart on 2002-08-19T11:58:54

Lmp3 will be closed and will never come back!
Oh bloody hell. <listen4ever.com> has been taken offline within 24 hours as well. It looks like the terrorists are winning... Yes I'm talking about the RIAA and the whole DMCA mob...

See Lawrence Lessig's talk, link currentluy at use.perl.org's home page. Maybe a 5 percent loss! While this study here seems to indicate that those people who regularily download and burn MP3's buy as many CD's as everybody else. Read more here and here.

Re:Gone

gnat on 2002-08-19T15:16:15

The good news is that their FTP site is still live. The bad news is that it doesn't give directory listings. The good news is that I snarfed some paths and filenames from the site while it was live.

I'll give out the code once I figure out how to detect an aborted get(). It seems like every second to third get is bungholed, and I'm not sure why.

--Nat

Re:Gone

briac on 2002-08-20T12:50:51

Perhaps you could use the $ua->request($req, $callback) variant to detect aborted downloads. I use something like this:

my ($bytes_read, $total_size);
my $res = $ua->request(
    HTTP::Request->new( GET => $url ),
      sub {
        $bytes_read  += length( $_[0] );
        $total_size ||= $_[1]->content_length;
        print ( shift() );
      }
    );

if ( $bytes_read != $total_size ){
    print "Aborted"
}
elsif ( $res->is_success ) {
    print "Ok"
}
else {
    print $res->status_line
}