HowTo use shell to download RapidShare Links

by

TUTORIAL: Using shell terminal (MacOSX,Linux) to DL/UL from Rapidshare Premium with cURL

This guide explains how to use terminal commands to download and upload from rapidshare.com. The utility we will be using is called cURL, an open source command-line HTTP tool. cURL comes standard with MacOSX, and can be installed easily with Linux (for example, to install on a Debian-based OS, like Ubuntu, just type the command sudo apt-get install curl). All these commands are done from the user’s home directory.

Step 1: Logging in to your Rapidshare premium account

This command will go to the Rapidshare login page and submit your username and password to log in. It will also create a file in your root directory called ‚.rapidshare‘. This file contains your login cookie. Once this file is created, you’ll never have to login again. Of course, replace USERID and PASSWORD with your information.

Let me explain the switches used here with the ‚curl‘ command. ‚-k‘ allows curl to access SSL (https) pages. ‚-c‘ writes a cookie file. ‚-d‘ sends form data.

Step 2: Downloading from Rapidshare

This command will access your cookie file and send the data along with the ‚-b‘ switch. ‚-L‘ follows the url if it forwards (which Rapidshare file urls do). ‚-O‘ will write the file to your local disk with the same file name. You can also use a switch to limit your download rate (–limit-rate 100K). Of course, replace URL with your rapidshare file url.

Step 3: Uploading to Rapidshare

This command will upload a file to your Rapidshare premium account. What it does is access your main premium page to find the upload url, which is dynamic, and parses it out for use in the final command of the pipe, the upload command. Be sure to replace USERID, PASSWORD, and NAME_OF_FILE_TO_UPLOAD. This command creates a temp file called .rapidtemp, because cURL won’t display upload progress in the terminal without writing the output to a file. You may also use –limit-rate in the final command there, to limit your upload rate if necessary.

Step 4: Creating a shell script

To create a shell script to download multiple files, start with a text editor. Your first line should be:

Then put in all your download and/or upload commands. Save the file. Then you must make the file executable in terminal:

Finally, run the script:

Step 5: Creating a new shell commands

Now, you can create shell scripts that become custom commands for you. For example, I created a file called ‚rapidget‘, which contains:

I saved the file, then copied it to /usr/local/bin, and chmodd +x it (You may need root access to do this: try the command ’sudo su‘).

Now I can use this command to download from terminal:

And for for uploading I call this command ‚rapidup‘:

To upload, I just navigate to the file’s directory and: