[HOWTO] Downloading from Rapidshare without Premium account

Share your own or any popular or interesting PHP + MySQL web apps here with the community, topics also covers Perl, Python or even Linux shell scripts.

[HOWTO] Downloading from Rapidshare without Premium account

Postby hypnosiss » Thu Feb 19, 2009 2:20 am

Downloading from Rapidshare without Premium account using QNAP box

I have managed my own script in python for downloading files from rapidshare without premium account, but it was little buggy.
Some of my friends told me about some other project writed in bash that is using wget. It could be also easy implemented into current Download station - but when it's not... here is a simple HOWTO use it using QNAP box and shell.


Installation tutorial:

1. Download and install Optware in QPKG section (administration panel) and than Enable it!
- we will need it later for one thing

2. Logon to Your QNAP box using SSH or Telnet (eg. using PuTTY)

3. Now it's time to create a file... Just follow instructions:

In a console enter this:
Code: Select all
# cd ..
# cd /share/Qdownload


It's time to create file called 'rapid.sh':
Code: Select all
# vi rapid.sh

Put "i" on a keyboard - now You'll be able to write text in file...
Just select code bellowe and copy it to clipboard:
Code: Select all
#!/bin/sh
#
# Download files from Rapidshare using free access (NOT premium accounts).
# Output files downloaded to standard output (one per line).
#
# Dependencies: sed, sleep, expr, wget.
#
# Web: http://code.google.com/p/megaupload-dl/wiki/RapidShare
# Contact: Arnau Sanchez <tokland@gmail.com>.
#
# License: GNU GPL v3.0: http://www.gnu.org/licenses/gpl-3.0-standalone.html
#
set -e

# Echo text to standard error.
#
debug() { echo "$@" >&2; }

# Get first line that matches a regular expression and extract string from it.
#
# $1: POSIX-regexp to filter (get only the first matching line).
# $2: POSIX-regexp to match (use parentheses) on the matched line.
#
parse() { sed -n "/$1/ s/^.*$2.*$/\1/p" | head -n1; }

# Check if a string ($2) matchs a regexp ($1)
#
match() { grep -q "$1" <<< "$2"; }

# Output a rapidshare file download URL given its rapidshare URL
#
# $1: A rapidshare URL
#
get_rapidshare_file_url() {
    URL=$1
    while true; do
        WAIT_URL=$(wget -O - "$URL" | parse '<form' 'action="\(.*\)"')
        test "$WAIT_URL" || { debug "can't get wait-page URL"; return 2; }
        DATA=$(wget -O - --post-data="dl.start=Free" "$WAIT_URL")
        test "$DATA" || { debug "can't get wait URL contents"; return 2; }
        LIMIT=$(echo "$DATA" | parse "try again" "\([[:digit:]]\+\) minutes")
        test -z "$LIMIT" && break
        debug "download limit reached: waiting $LIMIT minutes"
        sleep $((LIMIT*60))
    done
    FILE_URL=$(echo "$DATA" | parse "<form " 'action="\([^\"]*\)"')
    SLEEP=$(echo "$DATA" | parse "^var c=" "c=\([[:digit:]]\+\);")
    test "$FILE_URL" || { debug "can't get file URL"; return 2; }
    debug "URL File: $FILE_URL"
    test "$SLEEP" || { debug "can't get sleep time"; SLEEP=100; }
    debug "Waiting $SLEEP seconds"
    sleep $(($SLEEP + 1))
    echo $FILE_URL   
}

# Guess is item is a rapidshare URL, a generic URL (try bulk download)
# or a file with links
#
process_item() {
    ITEM=$1
    BASEURL="\(http://\)\?\(www\.\)\?rapidshare.com"
    if match "^$BASEURL/" "$ITEM"; then
        # Rapidshare URL
        echo "$ITEM"
    elif match "^\(http://\)" "$ITEM"; then
        # Non-rapidshare URL, extract RS links (highly fallible!) and download
        wget -O - "$ITEM" | tr -d '\r' | grep -o "$BASEURL/[^\"<>]\+" | uniq
    else
        # Assume it's a file and read links (discard comments and empty lines)
        grep -v "^[[:space:]]*\(#\|$\)" -- "$ITEM"
    fi
}

# Don't run main code on testing
#
test "$TESTMODE" = "1" && return

# Main
#
if test $# -eq 0; then
    debug "usage: $(basename $0) URL|FILE [URL|FILE ...]"
    exit 1
fi

for ITEM in "$@"; do
    process_item "$ITEM" | while read URL; do
        debug "start download: $URL"
        FILE_URL=$(get_rapidshare_file_url "$URL") &&
            wget "$FILE_URL" && echo $(basename "$FILE_URL") ||
            debug "could not download: $URL"
    done
done

Now You'll need to paste it into console and You can do this by clicking right mouse button on console (using PuTTY). - put Your mouse on a black screen of console and just click right mouse button.

Now using keyboard put this keys:
ENTER
ESC
SHIFT+Z
and than Z key

4. Now we will need to set permissions for this file.
Code: Select all
# chmod 755 rapid.sh


5. It's time to install screen through ipkg from optware
Code: Select all
# ipkg update
# ipkg install screen



Script installed


So always before using script it's better to go to the directory where it is saved:
Code: Select all
# cd ..
# cd /share/Qdownload


~~ Rapidshare links You can add by 3 ways: ~~

A) Using file which containt rapidshare links (all links should be seperated by enter)
Code: Select all
# ./rapid.sh urls.txt


B) Using direct link
Code: Select all
# ./rapid.sh http://server.com/page-with-rapidshare-links.html


C) Entering multiple links
Code: Select all
# ./rapid.sh rapidshare.com/link1 rapidshare.com/link2 rapidshare.com/link3 [...]



Now using 'screen':
- Do this:
Code: Select all
# screen -a
# cd /share/Qdownload
# ./rapid.sh [options]



- If You want to leave console and keep downloading rapidshare, put CTRL+A+D

- If You want go back to the screen and take a look on download progress, just enter this:
Code: Select all
# screen -r


- If You are on a screen and You wanna open new session (eg. for next download) put CTRL+A+C combination

- When You are on screen and You have multiple opened screens, You can switch between them using these combinations: CTRL+A+N (- mean next) or CTRL+A+P (- mean previous).

- If You wanna break working script, put CTRL+C keyboard combination.


Source: http://code.google.com/p/megaupload-dl/wiki/RapidShare
Script writed by: Arnau Sanchez. Licence: GNU GPL v3.0 .

Original polish version: http://www.qnapclub.pl/viewtopic.php?f= ... 2355#p2355

Tutorial writed by: hypnosiss(QNAPClub moderator)
Translation: SiLAS(QNAPClub Head Admin)
hypnosiss
Cadet
 
Posts: 11
Joined: Wed Jan 30, 2008 10:15 pm

Re: [HOWTO] Downloading from Rapidshare without Premium account

Postby Naberumut » Wed Apr 01, 2009 5:29 am

works great!
thanks for sharing :)
Naberumut
Cadet
 
Posts: 3
Joined: Mon Jan 12, 2009 3:05 am
NAS Model: TS-109/209 Pro II

Re: [HOWTO] Downloading from Rapidshare without Premium account

Postby bzhou » Fri Apr 10, 2009 2:31 am

ipkg install slimrat
bzhou
Crystal Warrior
 
Posts: 174
Joined: Tue Jan 29, 2008 8:43 am

Re: [HOWTO] Downloading from Rapidshare without Premium account

Postby David Huynh » Fri Aug 14, 2009 6:56 pm

Thank you for your script! But when trying to run it I got the message as below:

./rapid.sh http://rapidshare.com/files/263812139/i ... part01.rar
: invalid option 13: set: -
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]

I'm running on the latest version of firmware TS-109_3.1.0_Build0708 of the TS-109

Please help me!
David Huynh
Cadet
 
Posts: 5
Joined: Wed Aug 12, 2009 10:48 am
NAS Model: TS-419U

Re: [HOWTO] Downloading from Rapidshare without Premium account

Postby hypnosiss » Fri Aug 14, 2009 7:09 pm

make file "rapid.sh" again.

p.s. You can use slimrat (better) :)
hypnosiss
Cadet
 
Posts: 11
Joined: Wed Jan 30, 2008 10:15 pm

Re: [HOWTO] Downloading from Rapidshare without Premium account

Postby muskcp » Tue Mar 09, 2010 6:06 am

ipkg install plowdown
screen -a
plowdown urls.txt
ctrl+a+d
:)

Works just great.
muskcp
 

Re: [HOWTO] Downloading from Rapidshare without Premium account

Postby muskcp » Sat Apr 10, 2010 9:51 am

In some cases there may be required to update /repleace the lib.sh in /share/HDA_DATA/.qpkg/Optware/share/plowshare/ file with this one http://plowshare.googlecode.com/svn-his ... src/lib.sh
muskcp
 

Re: [HOWTO] Downloading from Rapidshare without Premium acco

Postby edasx » Tue May 25, 2010 3:35 pm

i am having following issue... =(

[~] # slimrat
This Perl not built to support threads
Compilation failed in require at /opt/bin/slimrat line 47.
BEGIN failed--compilation aborted at /opt/bin/slimrat line 47.
edasx
Cadet
 
Posts: 6
Joined: Sat Dec 26, 2009 10:41 am
NAS Model: TS-439 Pro


Return to PHP + MySQL / Perl / Python / Shell Script Modz

Who is online

Users browsing this forum: No registered users and 2 guests