This article explains how to download files from a rapidshare using a linux wget command line tool. Note that RapidShare Premium account is required in order to use wget for a rapishare download .
Using a wget to download from a rapidshare allows you to download multiple files in a single session using simple bash script. It also can be said, that using a bash script and wget to download rapidshare files is somewhat a cheap replacement of jDownloader tool.
This article will start by guiding a user to set a rapidshare account to allow rapidshare direct downloads. In the next step we will create a rapidshare authentication cookie which will be used to authenticate a user when downloading by wget. In the last step we will create a simple bash script to automate the whole process.
Direct download from rapidshare requires to set rapdishare direct download to ON, so start up your browser, login to rapidshare and set Direct download to ON.
In your web rapidshare account navigate to:
My RapidShare->File Manager->Download Settings->Direct Downloads-> ON

Rapdishare authentication works on a cookie basis. First run wget command to save a rapidshare authentication cookie to a ~/.rapidshare file.
$ wget -q -O - \ --post-data="sub=getaccountdetails_v1&withcookie=1&login=RAPIDSHARE-USER&password=RAPIDSHARE-PASS" \ https://api.rapidshare.com/cgi-bin/rsapi.cgi \ | grep cookie | cut -d= -f2 > ~/.rapidshare
If all went well your ~/.rapidshare file should contain a long string of characters and numbers.
The hardest part is done and now we can easily revoke our rapidshare authentication cookie to download any file from rapidshare using wget tool.
wget --header="Cookie: enc=`cat ~/.rapidshare`" http://rapidshare.com/files/rapidshare-example-file.rar
Now with simple modifications we can create a simple bash script to download multiple files in a single session. Store a following bash script into your home directory and name it:
wget-rapidshare.sh:
#!/bin/bash for i in $( cat $1); do wget --header="Cookie: enc=`cat ~/.rapidshare` " $i done
Execution:
$ chmod +x wget-rapidshare.sh $ ./wget-rapidshare.sh rapidshare-links.txt
As a for a post summary we can put all steps together into a single bash script file. This script will accept three arguments:
wget-rapidshare.sh:
#!/bin/bash rapidshare_cookie=`wget -q -O - \ --post-data="sub=getaccountdetails_v1&withcookie=1&login=$1&password=$2" \ https://api.rapidshare.com/cgi-bin/rsapi.cgi | grep cookie | cut -d= -f2` for i in $( cat $3); do wget --header="Cookie: enc=$rapidshare_cookie" $i done
Execution:
$ chmod +x wget-rapidshare.sh $ ./wget-rapidshare.sh rapidshare-username rapidshare-password rapidshare-links.txt