| WWW-RapidShare documentation | Contained in the WWW-RapidShare distribution. |
WWW::RapidShare - Download files from Rapidshare
This documentation refers to WWW::RapidShare version 0.3.1
Currently only works with rapidshare.com PREMIUM accounts.
More features coming soon!
use WWW::RapidShare;
my $rapid = WWW::RapidShare->new();
$rapid->url('http://rapidshare.com/files/file.zip');
$rapid->account_id('xxxxxx');
$rapid->password('xxxxxx');
# Download the file associated with the above URL.
# File will be saved in current directory.
$rapid->download_file();
Create a new WWW::RapidShare object
my $rapid = WWW::RapidShare->new();
None
A WWW::RapidShare object
* url - The URL to download the file
* account_id - Your account ID
* password - your password
Download the file associated with the URL
$rapid->download_file();
None
None
This method will create a file in the current directory
Rohan Almeida <rohan@almeida.in>
Copyright (c) 2008 Rohan Almeida <rohan@almeida.in>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
| WWW-RapidShare documentation | Contained in the WWW-RapidShare distribution. |
package WWW::RapidShare; use strict; use warnings; use base 'Class::Accessor'; use version; our $VERSION = qv('0.3.1'); use WWW::Mechanize; use File::Basename; use Data::Dumper; __PACKAGE__->mk_accessors(qw/ url account_id password _mech /);
sub new { my ($proto) = @_; my $class = ref $proto || $proto; my $self = {}; bless $self, $class; # Create our agent my $mech = WWW::Mechanize->new(); $self->_mech($mech); return $self; }
sub download_file { my $self = shift; $self->_mech->get($self->url); $self->_mech->form_number(2); $self->_mech->submit; # login $self->_mech->form_with_fields(qw/accountid password/); $self->_mech->field(accountid => $self->account_id); $self->_mech->field(password => $self->password); $self->_mech->submit(); $self->_mech->click_button(name => 'dl.start'); my $ah_form = pop @{ $self->_mech->forms }; my $file_name = basename($ah_form->action); print "Fetching " . $ah_form->action . " ...\n"; print "Saving file as $file_name\n"; $self->_mech->get( $ah_form->action, ":content_file" => $file_name ); } 1;