Here are function writen in Python for downloading files from Rapidshare. Unfortunetly you must wait couple of seconds, you can’t skip this because it seems that counting is on server side too.
from urllib2 import urlopen, Request from urllib import urlencode import os import re import time import base64 class DownloadLimitException(Exception): def __init__(self, *arg): Exception.__init__(self, *arg) def download(url): page = urlopen(url).read() action_url_regex = '<form id="[^"]*" action="([^"]*)"' s_url = re.search(action_url_regex, page) if s_url: url = s_url.group(1) data = urlencode({'dl.start': 'Free'}) request = Request(url, data) page = urlopen(request).read() action_url_regex = '<form name="[^"]*" action="([^"]*)"' c_regex = 'var c=([0-9]*);' limit_regex = 'You have reached the download limit for free-users' if re.match(limit_regex, page): raise DownloadLimitException(limit_regex) s_url = re.search(action_url_regex, page) s_c = re.search(c_regex, page) if s_url and s_c: url = s_url.group(1) c = int(s_c.group(1)) print "wait %i seconds" % c time.sleep(c) os.system('wget "%s"' % url)
You could use this function like this. Notice that you must have wget installed on your system.
def main(): from sys import argv if len(argv) == 2: try: download(argv[1]) except DownloadLimitException, print "limit reached" if __name__ == '__main__': main()