Tuesday, March 24, 2009

a command line tool to download files from rapidshare in Linux


this is a useful simple tool to download files from rapidshare without visual tools. it's perfect if you want download files on your home pc from your office.
you need a valid premium account on rapidshare and wget installed on your pc. to install it: as root yum install wget

create a new directory in your home directory (not as root!):
cd /home/your_user_name
mkdir .cookies
save a cookie in this folder with the following commands:
wget \
--save-cookies ~/.cookies/rapidshare \
--post-data "login=USERNAME&password=PASSWORD" \
-O - \
https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi \
/dev/null

copy and paste the following code and save it as "catchall"

#! /bin/bash
f=`date +%Y-%m-%d_%Hh%Mm%Ss`$RANDOM$RANDOM.log
if [ "$#" = "0" ]
then
echo url missing
else
a="$@"
wget -b -a $f --load-cookies ~/.cookies/rapidshare $a
fi

make it executable and copy it under /usr/bin: as root chmod +x catchall then cp catchall /usr/bin

in your Premium-Zone Settings set as true the option "Direct downloads, requested files are saved without redirection via RapidShare"

now you can download any rapidhare file with the command: catchall your_rapidshare_url_here

you'll get a different log file for each downloaded file. you can see the status of your download with this command: tail -f log_file_name

No comments: