Just developed a simple and dirty rapidshare download manager script in bash. You can pass on the links via STDIN and the script would download them one by one. All the downloaded data is saved in /downloads directory. The script also generates a simple log file named “downloads.log” in the /downloads directory. The script works only for premium rapidshare account users. You need to pass username and password of your rapidshare premium account via command line switches -u and -p respectively.
#!/bin/bash
# Rapidshare Download Manager script
# coder : Anil Dewani
howto()
{
echo "\
Rapidshare Download Manager Script \
Usage : $0 -u <username> -p <password>
<username> Rapidshare premium account username
<password> Rapidshare premium account password
This script is used to download a queue of rapidshare files.
It will create a 'downloads' directory. That's where all your
downloaded files are saved.
A downloads.log file would also be created in the downloads directory
it will display your download logs.
"
}
USER=
PASS=
while getopts "u:p:" OPTION
do
case $OPTION in
u)
USER=$OPTARG
;;
p)
PASS=$OPTARG
;;
?)
howto
exit
;;
esac
done
if [[ -z $USER ]] || [[ -z $PASS ]]
then
howto
exit 1
fi
echo "Enter rapidshare links and press ctrl + D when you are done.. "
cat > links
echo "Thanks for the links"
echo "Download Queue starting..."
mkdir ./downloads 2>/dev/null
lines=$(cat links | wc -l)
for (( c=1; c<=${lines}; c++ ))
do
link=$(cat links | sed -n ${c}p)
#check if link is an valid rapidshare.com link
match="rapidshare.com"
if [[ "${link}" =~ "${match}" ]] ; then
st=`date`
name=$(echo ${link} | awk -F "/" '{print $NF}')
# login and store cookiefile
curl \
--cookie-jar rapidsharecookie \
--data "login=${USER}&password=${PASS}" \
https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi \
> /dev/null 2>&1
echo "Downloading ... ${link}"
# download file using the cookiefile
curl -# -L -o "./downloads/${name}" --cookie rapidsharecookie ${link}
# write to the log
echo "Start: ${st} ${link} End: `date`" | cat >> ./downloads/downloads.log
else
echo "Link number ${c} is not a valid rapidshare link! This link will not be downloaded!"
fi
done
rm -f links
rm -f rapidsharecookie
# Rapidshare Download Manager script
# coder : Anil Dewani
howto()
{
echo "\
Rapidshare Download Manager Script \
Usage : $0 -u <username> -p <password>
<username> Rapidshare premium account username
<password> Rapidshare premium account password
This script is used to download a queue of rapidshare files.
It will create a 'downloads' directory. That's where all your
downloaded files are saved.
A downloads.log file would also be created in the downloads directory
it will display your download logs.
"
}
USER=
PASS=
while getopts "u:p:" OPTION
do
case $OPTION in
u)
USER=$OPTARG
;;
p)
PASS=$OPTARG
;;
?)
howto
exit
;;
esac
done
if [[ -z $USER ]] || [[ -z $PASS ]]
then
howto
exit 1
fi
echo "Enter rapidshare links and press ctrl + D when you are done.. "
cat > links
echo "Thanks for the links"
echo "Download Queue starting..."
mkdir ./downloads 2>/dev/null
lines=$(cat links | wc -l)
for (( c=1; c<=${lines}; c++ ))
do
link=$(cat links | sed -n ${c}p)
#check if link is an valid rapidshare.com link
match="rapidshare.com"
if [[ "${link}" =~ "${match}" ]] ; then
st=`date`
name=$(echo ${link} | awk -F "/" '{print $NF}')
# login and store cookiefile
curl \
--cookie-jar rapidsharecookie \
--data "login=${USER}&password=${PASS}" \
https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi \
> /dev/null 2>&1
echo "Downloading ... ${link}"
# download file using the cookiefile
curl -# -L -o "./downloads/${name}" --cookie rapidsharecookie ${link}
# write to the log
echo "Start: ${st} ${link} End: `date`" | cat >> ./downloads/downloads.log
else
echo "Link number ${c} is not a valid rapidshare link! This link will not be downloaded!"
fi
done
rm -f links
rm -f rapidsharecookie

Thanks