#!/usr/bin/env python # -*- coding: utf-8 -*- import re from time import time from Plugin import Plugin class RapidshareCom(Plugin): def __init__(self, parent): Plugin.__init__(self, parent) props = {} props['name'] = "RapidshareCom" props['type'] = "hoster" props['pattern'] = r"http://(?:www.)?(rs\d*.)?rapidshare.com/files/" props['version'] = "0.4" props['description'] = """Rapidshare.com Download Plugin""" props['author_name'] = ("spoob", "RaNaN") props['author_mail'] = ("spoob@pyload.org", "ranan@pyload.org") self.props = props self.parent = parent self.html = [None, None] self.html_old = None #time() where loaded the HTML self.time_plus_wait = None #time() + wait in seconds self.want_reconnect = False self.multi_dl = False self.read_config() if self.config['premium']: self.multi_dl = True self.start_dl = False def prepare(self, thread): pyfile = self.parent self.want_reconnect = False tries = 0 while not self.start_dl or not pyfile.status.url: self.req.clear_cookies() self.download_html() pyfile.status.exists = self.file_exists() if not pyfile.status.exists: raise Exception, "The file was not found on the server." pyfile.status.filename = self.get_file_name() if self.config['premium']: pyfile.status.url = self.parent.url return True self.download_serverhtml() pyfile.status.waituntil = self.time_plus_wait pyfile.status.want_reconnect = self.want_reconnect thread.wait(self.parent) pyfile.status.url = self.get_file_url() tries += 1 if tries > 5: raise Exception, "Error while preparing, HTML dump:"+ str(self.html[0]) + str(self.html[1]) return True def download_html(self): """ gets the url from self.parent.url saves html in self.html and parses """ url = self.parent.url self.html[0] = self.req.load(url) self.html_old = time() self.download_serverhtml() def download_serverhtml(self): """downloads html with the important informations """ file_server_url = re.search(r"