Gundumfx has asked for the wisdom of the Perl Monks concerning the following question:

im totally new to perl (started in it as of yesterday). and i started learning for this specific project (though i will definitely use it alot from now on.) i wrote this post already before, but comp crashed browser when i submitted. so anyways. this code should load RS links from a file and load cookies from another file, then use them both to download from the file hosting site Rapidshare (as a premium user, hence cookies). the code is horrid i know, and totally non-functioning. i was hoping anyone who replies would help with any tidbits, examples and fixes would be loved.
Also, i wrote this using backticks and wget, i can't get LWP to work on RS's cgi login page, if anyone knows how, i'd be beyond grateful. thanks.
#!/usr/bin/perl -w use strict; my $localvar = $ARGV[0]; open(FILE, "$localvar") or die "Failed to openfile: $!"; while(<FILE>){ if($_ =~ m/^http/) { my $wgetarg = '-q -c --load-cookies /home/Locke/.cookies/rapidshar +e'; my @wget = `wget $wgetarg $_`; foreach(@wget) { print 'Done with this file\n'; } } }

Replies are listed 'Best First'.
Re: Rapidshare and LWP
by dHarry (Abbot) on Jan 05, 2009 at 11:26 UTC

    I don't know rapidshare but first you will have to pass their login page. So you could generate a POST request with the necessary URL u & p in it.

    After you have established that you are allowed access you can generate GET requests for the files you want to download. It seems you need the combined filename and unique rapid file id for each file.

    This can all be done with LWP. I think the examples mentioned there resemble what you need?!

    I would like to mention that for automated communication with websites you can also use WWW::Mechanize.

    Could you post some of your LWP code?

    HTH
    dHarry

        WWW::Rapidshare is deprecated, RS uses a new interface and that module does not support it. thanks anyways, and i tried all google measures, i think i'm the first attempting this.
      thanks, i'll give WWW::Mechanize a shot. and that is my entire code. i scrapped the LWP code a while back because i couldn't get the hang of it. i'll give it some fresh eyes now.