Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: My Rapidshare Multiple Upload script

  1. #1
    Join Date
    Sep 2008
    Beans
    18
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    My Rapidshare Multiple Upload script

    Hello,

    I was searching around for a way to upload multiple files to my rapidshare account and i came across the linux perl script that they have written (which you can get here http://images.rapidshare.com/software/rsapi.pl)

    I wanted to automate the process somewhat so i wrote a little script to search for and upload rar files from a directory.

    heres the script:

    EDIT: PLEASE USE THE SCRIPT FROM POST #11 AND INSTRUCTIONS IN POST #9 AS THAT IS THE LATEST VERSION...

    Code:
    #!/bin/bash
    read -p "Enter file string to search and upload: " files
    find /location/of/files/ -iname "*$files*.rar" -exec perl rsapi.pl {} prem rapidshareusername rapidsharepassword \;
    find /location/of/files/ -iname "*$files*.rar" -exec rm -v {} \;
    PLEASE NOTE THAT THE ABOVE SCRIPT DELETES THE FILES IT HAS UPLOADED!!! DO NOT RUN ON YOUR IMPORTANT DATA.

    i normally create a temporary .rar to upload to so i like to have the script remove the file after its done. If you don't want to remove the files after upload remove the second find line from the script.

    heres the rapidshare uploader (i copied it from their website i have made no changes)
    Code:
    #!/usr/bin/perl
    
    # RapidShare AG OpenSource Perl Uploader V1.0. For non-commercial use only. All rights reserved.
    # Included: Uploading to free, collector's and premium-zone. The MD5-check after uploads checks if the upload worked.
    # NOT included in this version: Upload-resume via new RS API.
    # This is a PERL script written for experts and for coders wanting to know how to write own upload programs.
    # Tested under Linux and Linux only.
    # If you write your own upload-tools, please look at our rsapi.cgi calls. You need them to have fun.
    #
    # To upload a file, put this script on a machine with perl installed and use the following syntax:
    # perl rsapi.pl mytestfile.rar             (this uploads mytestfile.rar as a free user)
    # perl rsapi.pl archive.rar prem 334 test  (this uploads archive.rar to the premium-zone of login 334 with password test)
    # perl rsapi.pl a.rar col testuser mypw    (this uploads a.rar to the collector's-zone of login testuser with password mypw)
    #
    # We will publish another version with upload resume enabled soon, but this script actually works and we actually
    # want you to understand how it works and upload resume would make this script even more complex.
    
    use strict;
    use warnings;
    use Digest::MD5("md5_hex");
    use Fcntl;
    use IO::Socket;
    
    my ($file, $filename, $uploadpath, $size, $socket, $uploadserver, $cursize, $fh, $bufferlen, $buffer, $boundary, $header, $contentheader,
    $contenttail, $contentlength, $result, $maxbufsize, $md5hex, $filecontent, $size2, %key_val, $login, $password, $zone);
    
    
    
    # This chapter sets some vars and parses some vars.
    $/ = undef;
    $file = $ARGV[0] || die "Syntax: $0 <filename to upload> <free|prem|col> [login] [password]\n";
    $zone = $ARGV[1] || "";
    $login = $ARGV[2] || "";
    $password = $ARGV[3] || "";
    $maxbufsize = 64000;
    $uploadpath = "l3";
    $cursize = 0;
    $size = -s $file || die "File $file is empty or does not exist!\n";
    $filename = $file =~ /[\/\\]([^\/\\]+)$/ ? $1 : $file;
    
    
    
    # This chapter checks the file and calculates the MD5HEX of the existing local file.
    print "File $file has $size bytes. Calculating MD5HEX...\n";
    open(FH, $file) || die "Unable to open file: $!\n";
    $filecontent = <FH>;
    close(FH);
    $md5hex = uc(md5_hex($filecontent));
    $size2 = length($filecontent);
    print "MD5HEX is $md5hex ($size2 bytes analyzed.)\n";
    unless ($size == $size2) { die "Strange error: $size bytes found, but only $size2 bytes analyzed?\n" }
    
    
    
    # This chapter finds out which upload server is free for uploading our file by fetching http://rapidshare.com/cgi-bin/rsapi.cgi?sub=nextuploadserver_v1
    if ($login and $password) { print "Trying to upload to your premium account.\n" } else { print "Uploading as a free user.\n" }
    print "Uploading as filename '$filename'. Getting upload server infos.\n";
    $socket = IO::Socket::INET->new(PeerAddr => "rapidshare.com:80") || die "Unable to open port: $!\n";
    print $socket qq|GET /cgi-bin/rsapi.cgi?sub=nextuploadserver_v1 HTTP/1.0\r\n\r\n|;
    ($uploadserver) = <$socket> =~ /\r\n\r\n(\d+)/;
    unless ($uploadserver) { die "Uploadserver invalid? Internal error!\n" }
    print "Uploading to rs$uploadserver$uploadpath.rapidshare.com\n";
    
    
    
    # This chapter opens our file and the TCP socket to the upload server.
    sysopen($fh, $file, O_RDONLY) || die "Unable to open file: $!\n";
    $socket = IO::Socket::INET->new(PeerAddr => "rs$uploadserver$uploadpath.rapidshare.com:80") || die "Unable to open port: $!\n";
    
    
    
    # This chapter constructs a (somewhat RFC valid) HTTP header. See how we pass rsapi_v1=1 to the server to get a program-friendly output.
    $boundary = "---------------------632865735RS4EVER5675865";
    $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="rsapi_v1"\r\n\r\n1\r\n|;
    
    if ($zone eq "prem" and $login and $password) {
      $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="login"\r\n\r\n$login\r\n|;
      $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="password"\r\n\r\n$password\r\n|;
    }
    
    if ($zone eq "col" and $login and $password) {
      $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="freeaccountid"\r\n\r\n$login\r\n|;
      $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="password"\r\n\r\n$password\r\n|;
    }
    
    $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="filecontent"; filename="$filename"\r\n\r\n|;
    $contenttail = "\r\n$boundary--\r\n";
    $contentlength = length($contentheader) + $size + length($contenttail);
    $header = qq|POST /cgi-bin/upload.cgi HTTP/1.0\r\nContent-Type: multipart/form-data; boundary=$boundary\r\nContent-Length: $contentlength\r\n\r\n|;
    
    
    
    #This chapter actually sends all the data, header first, to the upload server.
    print $socket "$header$contentheader";
    
    while ($cursize < $size) {
      $bufferlen = sysread($fh, $buffer, $maxbufsize, 0) || 0;
      unless ($bufferlen) { die "Error while sending data: $!\n" }
      print "$cursize of $size bytes sent.\n";
      $cursize += $bufferlen;
      print $socket $buffer;
    }
    
    print $socket $contenttail;
    
    
    
    # OK, all is sent. Now lets fetch the server's reponse and analyze it.
    print "All $size bytes sent to server. Fetching result:\n";
    ($result) = <$socket> =~ /\r\n\r\n(.+)/s;
    unless ($result) { die "Ooops! Did not receive any valid server results?\n" }
    print "$result >>> Verifying MD5...\n";
    
    foreach (split(/\n/, $result)) {
      if ($_ =~ /([^=]+)=(.+)/) { $key_val{$1} = $2 }
    }
    
    
    
    # Now lets check if the result contains (and it should contain) the MD5HEX of the uploaded file and check if its identical to our MD5HEX.
    unless ($key_val{"File1.4"}) { die "Ooops! Result did not contain MD5? Maybe you entered invalid login data.\n" }
    if ($md5hex ne $key_val{"File1.4"}) { die qq|Upload FAILED! Your MD5HEX is $md5hex, while the uploaded file has MD5HEX $key_val{"File1.4"}!\n| }
    print "MD5HEX value correct. Upload completed without errors. Saving links to rsulres.txt\n\n\n";
    
    
    
    # Maybe you want the links saved to a logfile? Here we go.
    open(O, ">>rsulres.txt");
    print O $result . "\n";
    close(O);
    
    
    
    # Thats it. Have fun experimenting with this script. Now lets say...
    exit;
    Usage:
    You basically copy the two code fragments into separate files. The first bash script can be named anything (i named mine rsup.sh) but the second one needs to be named "rsapi.pl".

    Make sure to change the permissions of the files so that they can both be executed as programs. From the file manager right click on the files individually and click on properties. Goto the permissions tab and make sure that the Allow executing file as program is ticked.

    After that start a terminal and cd into the directory you saved rsup.sh in, and run the script with:

    Code:
    ./rsup.sh
    My output for a 'test' search string:

    Code:
    anthrax@anand:~/rsup$ ./rsup.sh
    Enter file string to search and upload: test
    File /home/anthrax/rsup/files/test1.rar has 2492 bytes. Calculating MD5HEX...
    MD5HEX is E5B58CEAE166C332D4350AFCFECD3AF5 (2492 bytes analyzed.)
    Trying to upload to your premium account.
    Uploading as filename 'test1.rar'. Getting upload server infos.
    Uploading to rs231l3.rapidshare.com
    0 of 2492 bytes sent.
    All 2492 bytes sent to server. Fetching result:
    savedfiles=1 forbiddenfiles=0 premiumaccount=******* freeowner=0
    File1.1=http://rapidshare.com/files/247892799/test1.rar.html
    File1.2=
    File1.3=
    File1.4=
    File1.5=Completed
     >>> Verifying MD5...
    MD5HEX value correct. Upload completed without errors. Saving links to rsulres.txt
    
    
    File /home/anthrax/rsup/files/test.rar has 2492 bytes. Calculating MD5HEX...
    MD5HEX is E5B58CEAE166C332D4350AFCFECD3AF5 (2492 bytes analyzed.)
    Trying to upload to your premium account.
    Uploading as filename 'test.rar'. Getting upload server infos.
    Uploading to rs622l3.rapidshare.com
    0 of 2492 bytes sent.
    All 2492 bytes sent to server. Fetching result:
    savedfiles=1 forbiddenfiles=0 premiumaccount=******* freeowner=0
    File1.1=http://rapidshare.com/files/247892810/test.rar.html
    File1.2=
    File1.3=
    File1.4=
    File1.5=Completed
     >>> Verifying MD5...
    MD5HEX value correct. Upload completed without errors. Saving links to rsulres.txt
    
    
    File /home/anthrax/rsup/files/test2.rar has 2492 bytes. Calculating MD5HEX...
    MD5HEX is E5B58CEAE166C332D4350AFCFECD3AF5 (2492 bytes analyzed.)
    Trying to upload to your premium account.
    Uploading as filename 'test2.rar'. Getting upload server infos.
    Uploading to rs744l3.rapidshare.com
    0 of 2492 bytes sent.
    All 2492 bytes sent to server. Fetching result:
    savedfiles=1 forbiddenfiles=0 premiumaccount=******* freeowner=0
    File1.1=http://rapidshare.com/files/247892826/test2.rar.html
    File1.2=
    File1.3=
    File1.4=
    File1.5=Completed
     >>> Verifying MD5...
    MD5HEX value correct. Upload completed without errors. Saving links to rsulres.txt
    
    
    removed `/home/anthrax/rsup/files/test1.rar'
    removed `/home/anthrax/rsup/files/test.rar'
    removed `/home/anthrax/rsup/files/test2.rar'
    There is a lot that can be done with this script. At the moment it's only asking for the filename to search for in a specific directory (assuming you keep all your upload files in the same directory like i do), and it is only searching for .rar files(i mainly upload .rar's) . If you want to specify the directory with the files in it as part of the input use this script instead:

    Code:
    #!/bin/bash
    read -p "Enter the location to search for files: " location
    read -p "Enter file string to search and upload: " files
    find $location -iname "*$files*.rar" -exec perl rsapi.pl {} prem rapidshareusername rapidsharepassword \;
    find $location -iname "*$files*.rar" -exec rm -v {} \;
    You can of course modify the filetypes and any of the other search parameters.

    I hope that this helps some people. If it does post a reply. Also if anyone has any suggestions on how to improve the script please let me know.

    Now we need somebody to give this a GUI.
    Last edited by darthrax; August 19th, 2009 at 03:19 PM.

  2. #2
    Join Date
    Jul 2009
    Beans
    4

    Re: My Rapidshare Multiple Upload script

    Thanks, it works great!

    Is there a way to resume uploads?

    PS: Sorry for my english. I am a Greek who lives now in Greece, but who lived 27 years in Germany. So I had to learn greek and german... and I can not speek english very well.

  3. #3
    Join Date
    Sep 2008
    Beans
    18
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Smile Re: My Rapidshare Multiple Upload script

    heres the new rapidshare upload script v2.1.1

    i believe that the syntax has changed from:
    Code:
    # perl rsapi.pl mytestfile.rar             (this uploads mytestfile.rar as a free user)
    # perl rsapi.pl archive.rar prem 334 test  (this uploads archive.rar to the premium-zone of login 334 with password test)
    # perl rsapi.pl a.rar col testuser mypw    (this uploads a.rar to the collector's-zone of login testuser with password mypw)
    to
    Code:
    # perl rsapi.pl free mytestfile.rar        (this uploads mytestfile.rar as a free user)
    # perl rsapi.pl prem archive.rar 334 test  (this uploads archive.rar to the premium-zone of login 334 with password test)
    # perl rsapi.pl col a.rar testuser mypw    (this uploads a.rar to the collector's-zone of login testuser with password mypw)
    so change the script accordingly.

    Code:
    #!/usr/bin/perl
    
    # Version 2.1.1 (13. July 2007)
    
    # RapidShare AG OpenSource Perl Uploader V2 (with upload resume). For non-commercial use only. All rights reserved.
    # Included: Uploading to free, collector's and premium-zone. The MD5-check after uploads checks if the upload worked.
    # Upload resume can continue aborted downloads up to 24 hours after the download aborted. This means, incomplete files
    # will automatically be deleted from the RapidShare servers 24 hours after the first chunk arrived.
    # This is a PERL script written for experts and for coders wanting to know how to write own upload programs.
    # Tested under Linux and Linux only.
    # If you write your own upload-tools, please look at our rsapi.cgi calls. You need them to have fun.
    #
    # To upload a file, put this script on a machine with perl installed and use the following syntax:
    # perl rsapi.pl free mytestfile.rar        (this uploads mytestfile.rar as a free user)
    # perl rsapi.pl prem archive.rar 334 test  (this uploads archive.rar to the premium-zone of login 334 with password test)
    # perl rsapi.pl col a.rar testuser mypw    (this uploads a.rar to the collector's-zone of login testuser with password mypw)
    
    use strict;
    use warnings;
    use Digest::MD5("md5_hex");
    use Fcntl;
    use IO::Socket;
    
    my ($file, $zone, $login, $password, $uploadpath, $cursize, $size, $filecontent, $md5hex, $size2, $socket, $uploadserver, $killcode);
    
    
    
    # This chapter sets some vars and parses some vars.
    $/ = undef;
    $SIG{PIPE} = 'IGNORE';
    $file = $ARGV[0] || die "Syntax: $0 <filename to upload> <free|prem|col> [login] [password]\n";
    $zone = $ARGV[1] || "";
    $login = $ARGV[2] || "";
    $password = $ARGV[3] || "";
    $uploadpath = "l3";
    $size = -s $file || die "File $file is empty or does not exist!\n";
    
    
    
    # This chapter checks the file and calculates the MD5HEX of the existing local file.
    print "File $file has $size bytes. Calculating MD5HEX...\n";
    open(FH, $file) || die "Unable to open file: $!\n";
    $filecontent = <FH>;
    close(FH);
    $md5hex = md5_hex($filecontent);
    $size2 = length($filecontent);
    print "MD5HEX is $md5hex ($size2 bytes analyzed)\n";
    unless ($size == $size2) { die "Strange error: $size bytes found, but only $size2 bytes analyzed?\n" }
    
    
    
    # This chapter finds out which upload server is free for uploading our file by fetching http://rapidshare.com/cgi-bin/rsapi.cgi?sub=nextuploadserver_v1
    if ($login and $password) { print "Trying to upload to your $zone account.\n" } else { print "Uploading as a free user.\n" }
    print "Getting upload server infos.\n";
    $socket = IO::Socket::INET->new(PeerAddr => "rapidshare.com:80") || die "Unable to open port: $!\n";
    print $socket qq|GET /cgi-bin/rsapi.cgi?sub=nextuploadserver_v1 HTTP/1.0\r\n\r\n|;
    ($uploadserver) = <$socket> =~ /\r\n\r\n(\d+)/;
    unless ($uploadserver) { die "Uploadserver invalid? Internal error!\n" }
    print "Uploading to rs$uploadserver$uploadpath.rapidshare.com\n";
    
    $cursize = 0;
    while ($cursize < $size) { $cursize = &uploadchunk($file, $md5hex, $size, $cursize, "rs$uploadserver$uploadpath.rapidshare.com:80") }
    
    
    
    sub uploadchunk {
      my $file = shift || die;
      my $md5hex = shift || die;
      my $size = shift || die;
      my $cursize = shift || 0;
      my $fulluploadserver = shift || die;
    
      my ($uploaddata, $wantchunksize, $fh, $socket, $boundary, $contentheader, $contenttail, $contentlength, $header, $chunks, $chunksize,
    $bufferlen, $buffer, $result, $fileid, $complete, $resumed, $filename);
    
      if (-e "$file.uploaddata") {
        print "Found .uploaddata! Overriding settings and trying to resume.\n";
        open(I, "$file.uploaddata") or die "Unable to open file: $!\n";
        ($fulluploadserver, $fileid, $killcode) = split(/\n/, <I>);
        print "Uploadserver=$fulluploadserver\nFile-ID=$fileid\nKillcode=$killcode\n";
        close(I);
        print "Checking if RS gives an OK and the position...\n";
        $socket = IO::Socket::INET->new(PeerAddr => "rapidshare.com:80") || die "Unable to open port: $!\n";
        print $socket qq|GET /cgi-bin/rsapi.cgi?sub=checkincomplete_v1&fileid=$fileid&killcode=$killcode HTTP/1.0\r\n\r\n|;
        $result = <$socket>;
        unless ($result =~ /\r\n\r\n(\d+)/) { die "I can't resume the file. Please delete $file.uploaddata. RS said:\n$result\n" }
        $cursize = $1;
        print "All ok. The upload stopped at $cursize. Trying to resume.\n";
        $resumed = 1;
      }
    
      $wantchunksize = 1024000;
    
      if ($size > $wantchunksize) {
        $chunks = 1;
        $chunksize = $size - $cursize;
        if ($chunksize > $wantchunksize) { $chunksize = $wantchunksize } else { $complete = 1 }
      } else {
        $chunks = 0;
        $chunksize = $size;
      }
    
      print "Upload chunk is $chunksize bytes starting at $cursize.\n";
    
      sysopen($fh, $file, O_RDONLY) || die "Unable to open file: $!\n";
      $filename = $file =~ /[\/\\]([^\/\\]+)$/ ? $1 : $file;
      $socket = IO::Socket::INET->new(PeerAddr => $fulluploadserver) || die "Unable to open socket: $!\n";
      $boundary = "---------------------632865735RS4EVER5675865";
      $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="rsapi_v1"\r\n\r\n1\r\n|;
    
      if ($resumed) {
        $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="fileid"\r\n\r\n$fileid\r\n|;
        $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="killcode"\r\n\r\n$killcode\r\n|;
        if ($complete) { $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="complete"\r\n\r\n1\r\n| }
      } else {
        if ($zone eq "prem" and $login and $password) {
          $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="login"\r\n\r\n$login\r\n|;
          $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="password"\r\n\r\n$password\r\n|;
        }
    
        if ($zone eq "col" and $login and $password) {
          $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="freeaccountid"\r\n\r\n$login\r\n|;
          $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="password"\r\n\r\n$password\r\n|;
        }
    
        if ($chunks) { $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="incomplete"\r\n\r\n1\r\n| }
      }
    
      $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="filecontent"; filename="$filename"\r\n\r\n|;
      $contenttail = "\r\n$boundary--\r\n";
      $contentlength = length($contentheader) + $chunksize + length($contenttail);
    
      if ($resumed) {
        $header = qq|POST /cgi-bin/uploadresume.cgi HTTP/1.0\r\nContent-Type: multipart/form-data; boundary=$boundary\r\nContent-Length: $contentlength\r\n\r\n|;
      } else {
        $header = qq|POST /cgi-bin/upload.cgi HTTP/1.0\r\nContent-Type: multipart/form-data; boundary=$boundary\r\nContent-Length: $contentlength\r\n\r\n|;
      }
    
      print $socket "$header$contentheader";
    
      sysseek($fh, $cursize, 0);
      $bufferlen = sysread($fh, $buffer, $wantchunksize) || 0;
      unless ($bufferlen) { die "Error while reading file: $!\n" }
      print "Sending $bufferlen bytes.\n";
      $cursize += $bufferlen;
      print $socket $buffer;
      print $socket $contenttail;
      print "Server response:\n";
      ($result) = <$socket> =~ /\r\n\r\n(.+)/s;
      unless ($result) { die "Ooops! Did not receive any valid server results?\n" }
      print $result . "\n";
    
      if ($resumed) {
        if ($complete) {
          if ($result =~ /^COMPLETE,(\w+)/) {
            print "Upload completed! MD5HEX=$1 Checking MD5...\n";
            if ($md5hex ne $1) { die "MD5-CHECK NOT PASSED! LOCAL=$md5hex REMOTE=$1\n" }
            print "MD5-check passed. Upload OK! Saving status to rsapiuploads.txt\n";
            open(O,">>rsapiuploads.txt") or die "Unable to save to rsapiuploads.txt: $!\n";
            print O "Upload OK!\n\n";
            close(O);
            unlink("$file.uploaddata");
          } else {
            die "Unexpected server response!\n";
          }
        } else {
          if ($result =~ /^CHUNK,(\d+)/) {
            print "Chunk upload completed! Uploaded=$1\n";
          } else {
            die "Unexpected server response!\n";
          }
        }
      } else {
        if ($result =~ /files\/(\d+)/) { $fileid = $1 } else { die "Server result did not contain a file ID.\n" }
        unless ($result =~ /File1\.3=(\d+)/ and $1 == $cursize) { die "Server did not save all data we sent.\n" }
        unless ($result =~ /File1\.2=.+?killcode=(\d+)/) { die "Server did not send our killcode.\n" }
    
        $killcode = $1;
    
        open(O,">>rsapiuploads.txt") or die "Unable to save to rsapiuploads.txt: $!\n";
        print O "Uploading $file. Download-links:\n$result";
        close(O);
    
        if ($chunks) {
          open(O, ">$file.uploaddata") or die "Unable to save upload server: $!\n";
          print O "$fulluploadserver\n$fileid\n$killcode\n";
          close(O);
        }
      }
    
      return $cursize;
    }
    In other news i'm working on a nautilus script that will automate this entire process. Now you can upload to rapidshare by right clicking the target file and selecting rsup! All temporary archives (for filesize greater than 100Mb) are created automatically, uploaded and deleted, essentially making no changes to your system and leaving a backup on rapidshare. Currently testing it. Will post the full thing when it's ready.

  4. #4
    Join Date
    Jul 2009
    Beans
    4

    Re: My Rapidshare Multiple Upload script

    Ths a lot man, I was looking some way how to upload files from my home server.
    But I used new RSAPI v2.1.1 and it has still the same syntax as the old one, they had probably eroor in that comment.

  5. #5
    Join Date
    Nov 2008
    Location
    human body
    Beans
    560
    Distro
    Ubuntu

    Re: My Rapidshare Multiple Upload script

    Thanks for this usefull script. Say what happens if connection drop. This is important one.

  6. #6
    Join Date
    Jul 2009
    Beans
    4

    Re: My Rapidshare Multiple Upload script

    It works super! Thank you very much my friend!!!

  7. #7
    Join Date
    Sep 2008
    Beans
    18
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Smile Re: My Rapidshare Multiple Upload script

    Re: My Rapidshare Multiple Upload script
    Ths a lot man, I was looking some way how to upload files from my home server.
    But I used new RSAPI v2.1.1 and it has still the same syntax as the old one, they had probably eroor in that comment.
    Thanks for pointing that out GabboCZ. Your right!! there is an error in the comment because when you run the rsapi.pl in the terminal its output is

    Code:
    Syntax: ~/.rsapi.pl <filename to upload> <free|prem|col> [login] [password]

  8. #8
    Join Date
    Sep 2006
    Beans
    3,165
    Distro
    Ubuntu Karmic Koala (testing)

    Re: My Rapidshare Multiple Upload script

    I am gonna try it out, thanks.

  9. #9
    Join Date
    Sep 2008
    Beans
    18
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Talking My Rapidshare Upload script - With Right-Click Upload

    Greetings all...

    It's finally here...the right-click rapidshare upload!!!

    there are still a few bugs in it (i feel) but its working and you can use it.

    The Procedure:

    1. The script requires 7zip so if you don't have it installed type the following code in the terminal
    Code:
    sudo apt-get install p7zip p7zip-full p7zip-rar
    2. copy the rapidshare script from above (v2.1.1) and save it in your ~/.gnome2/nautilus-scripts folder as ".rsapi.pl" (note the '.' before the name makes the file hidden so it doesn't show up on your right click menu. also remove the quotes before saving.)

    3. copy the following code and save it in your ~/.gnome2/nautilus-scripts folder as "RapidUpload" (or anything else. Remember to remove the quotes). Enter your Rapidshare user name, password and account type in the appropriate place. DO NOT PUT A SPACE (" ") BETWEEN THE = AND YOUR USERNAME/PASSWORD/ACCOUNT TYPE.

    Code:
    #!/bin/bash
    #
    # Right-click upload files to your rapidshare account
    #
    # Owner: 
    #   Anand Kapre
    #   ak@anandkapre.com
    #
    # Licence: GNU GPL
    # Copyright (C) Anand Kapre
    #
    # Dependency:
    #   7zip
    #
    # Created on Tuesday August 18th 2009
    #
    # Tested on Ubuntu 9.04 Jaunty Jackalope
    # accounttype can be free prem col
    #
    rapidshareusername=username 
    rapidsharepassword=password
    accounttype=prem
    (
    files=`echo "$1" | sed 's/ /\\ /g'`
    size=$(stat -c%s "$files")
    folder=$(pwd)
    if [ $size -gt 104857600 ]; then
    echo "Filesize greater than 100Mb, adding files to archive..."
    7z a -tzip -v99m "$files".zip "$folder"/"$files"
    echo "Created temporary archive, Proceeding with upload..."
    find "$folder" -iname "*$files*.zip*" -exec ~/.gnome2/nautilus-scripts/.rsapi.pl {} $accounttype $rapidshareusername $rapidsharepassword \;
    echo "Upload Completed, DeletiIncompleteng archives..."
    find "$folder" -iname "*$files*.zip*" -exec rm -v {} \;
    echo "JOB DONE"
    else
    echo "Filesize lesser than 100Mb, Proceeding with upload..."
    find "$folder" -iname "$files" -exec ~/.gnome2/nautilus-scripts/.rsapi.pl {} $accounttype $rapidshareusername $rapidsharepassword \;
    echo "JOB DONE"
    fi
    echo "You may close this window"
    ) | zenity --title=RapidUpload --text-info --width=500 --height=500
    4. Make sure both files ".rsapi.pl" and "RapidUpload" are executable. I've described the process in my first post.

    5. Thats it!!! Your done.

    Usage:

    Right click on any file, and goto Scripts > RapidUpload

    A dialog will pop up showing you what the program is doing. For files larger than 100Mb the script uses 7zip to compress the files into 100Mb archives. It then uploads the archive(s) and deletes them. So make sure you have at least the same amount of diskspace free for larger files.

    The newer version uf rsapi (2.1.1) resumes uploads so broken uploads will be resumed within 24 hours. Broken uploads show up in the Rapidshare Premium / Collecter Zone with an Incomplete Status.

    BUGS:

    1. Multiple selected files do not work as yet. If you select more than one file to upload at a time the first file will be uploaded that many times.


    2. Two files are created after the script runs one is rsapiuploads.txt and the other is filename.uploaddata. I don't want them but some people may find them useful. I tried to automatically delete them from the script but it's not happening. IF YOUR UPLOAD IS NOT COMPLETE, DO NOT DELETE THESE FILES AS THEY ALLOW YOU TO RESUME THE UPLOAD. EDIT: The filename.uploaddata file is removed automatically by the rsapi.pl script.

    3. Cheesy looking text display...I STILL WANT A GUI...SOMEONE HELP ME!!!

    If you find any more bugs please let me know... i don't think there are any but you never know. I had some issues with spaces in the path names but i resolved that and the script handles spaces fine now.

    PS: TO RESUME UPLOADS JUST RIGHT CLICK AND RUN RAPIDUPLOAD ON THE SAME FILE AGAIN. ITS THAT SIMPLE
    you can download the two scripts from
    Code:
    http://rapidshare.com/files/268537486/.rsapi.pl.html
    http://rapidshare.com/files/269110306/Rapid_Upload.html
    UPLOADED BY RAPIDUPLOAD!!!
    Last edited by darthrax; August 19th, 2009 at 01:51 PM.

  10. #10
    Join Date
    Sep 2006
    Beans
    3,165
    Distro
    Ubuntu Karmic Koala (testing)

    Re: My Rapidshare Upload script - With Right-Click Upload

    Please fix Bug #1 and i will blog about it. It is not very useful FOR ME with that bug

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •