Contents[Hide]

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.

1. Set rapidshare direct download to ON

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

Wget rapidshare direct download

2. Create a rapidshare authentication cookie

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.

3. Download from rapidshare using authentication cookie and wget

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

4. Rapidshare wget automated bash script

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

5. wget rapidshare download all in one

As a for a post summary we can put all steps together into a single bash script file. This script will accept three arguments:

  • rapidshare account username
  • rapidshare account password
  • text file with rapidshare links to download ( one link per line ! )

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


Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top