Rapidshare leecher for Linux



What is this?

This is the script in BASH for semi-automation of rapidshare.com files downloading process, using the Free account. In this case semi-automation means that the only user interaction required is entering the access code for the file.

How to use it?

It is very simple. The only thing you have to do to use it is to put the script into the directory with write rights and to prepare the files list, comprised of the rapidshare url-s, to the rapidlist file. Then just launch the the script and it will download the files from list. The script will get the first file from the list and check whether it is available. If it is so, the proper download page will be opened in the browser (default in xlinks2, but you can customize the browser application), you will be requested for the access code, and then you will be able to get the file. After downloading the file you should just close the browser and script will advance to next file from the list, waiting for its avaliability.

Note, that the script doesn't cheat the rapidshare site, just automates the downloading process of the files list, so you don't have to do it manually, including testing of file avaliability on the webpage and iterating through the list of your links.

I recomend to use the script in following way (to download new list of files):

  1. Remove old rapidno and rapidlist files from previous downloading and prepare the list of url-s into new rapidlist file
  2. Start the script by "./leech beep" command
  3. When the first file will be downloaded close the browser, leave the console open on this desktop and back to the work
  4. The script will check the next file availability every 2 minutes, and when the file will be finally available it'll notify you by beeping with your speaker
  5. The script runtime can be always interrupted using Ctrl+C and the next time the download process will be started from the interrupted file

Requirements

In the default configuration the following tools are required to run it:

How does it work?

The script simply gets the webpages from rapidshare and parses it, gathering information required to pass each download step, and sends the appropriate data to the server using POST method. First, it looks for the list file and for the index file rapidno. This file contains the index of the next URL to retrieve, and after getting it the appropriate URL from the list is downloaded from the server. File obtained in this step contains only the form to select the download method (free or premium service). The script automatically chooses the free service and gets the webpage with the next form. Here it checks whether the file is available or not and if it is, it opens the configured web browser on the downloaded page, where user has to write the access code from image and get the file. If the file is not available yet, it will print the amount of time to wait for the file and hangs for 2 minutes before next check. If the file is downloaded, the file index increases and the next file will be retrieved in the iteration.

Note, that the script parses HTML code from rapidshare website, so when this code will change, the script can work not properly. In this case the appropriate HTML templates in the source code should be changed.

Configuration

The following variables can be configured within the script scope:

The wget version

Well, I have been playing with the script then, and it turned out that whole rapidshare process can be performed without the browser, only using wget. You can get the image from the download form and then request the file with accesscode POST variable set to the string from the image. In this case the file is being downloaded properly. So I've implemented it in this way - the image is got to the temporary file, is displayed in the user-defined image viewer, and then the user is requested to give the access code in the console. In this case we have no any advantages regarding the prior resolution, but I've been thinking about some automation of the access code recognition, which can be injected here to completely automate whole process. I've checked the gocr but this tool doesn't recognize properly the text. So if somebody has any idea how to do it (use another OCR or write the own piece of code - I have no time to do it for now) can improve my script in that point.

Downloads

Links

I use Ubuntu, so I've opened threads concerning this tool on the ubuntu forums at:

l0co@wp.pl