diff options
-rw-r--r-- | config | 4 | ||||
-rw-r--r-- | module/plugins/RapidshareCom.py | 19 |
2 files changed, 18 insertions, 5 deletions
@@ -1,5 +1,5 @@ [remote] -port = 7272 +port = 7270 password = pwhere [webinterface] @@ -22,7 +22,7 @@ use_reconnect = False link_file = links.txt failed_file = failed_links.txt reconnect_method = reconnect_method -debug_mode = False +debug_mode = True max_download_time = 18000 [updates] diff --git a/module/plugins/RapidshareCom.py b/module/plugins/RapidshareCom.py index 5044c2e00..73424696e 100644 --- a/module/plugins/RapidshareCom.py +++ b/module/plugins/RapidshareCom.py @@ -14,7 +14,7 @@ class RapidshareCom(Plugin): props = {} props['name'] = "RapidshareCom" props['type'] = "hoster" - props['pattern'] = r"http://(?:www\.)?(?:rs\d*\.)?rapidshare.com/files/(\d*?)/(.*)" + props['pattern'] = r"http://[\w\.]*?rapidshare.com/files/(\d*?)/(.*)" props['version'] = "0.5" props['description'] = """Rapidshare.com Download Plugin""" props['author_name'] = ("spoob", "RaNaN", "mkaay") @@ -25,6 +25,7 @@ class RapidshareCom(Plugin): self.html_old = None #time() where loaded the HTML self.time_plus_wait = None #time() + wait in seconds self.want_reconnect = False + self.no_slots = False self.read_config() if self.config['premium']: self.multi_dl = True @@ -64,8 +65,13 @@ class RapidshareCom(Plugin): pyfile.status.want_reconnect = self.want_reconnect thread.wait(self.parent) + if self.no_slots: + self.download_serverhtml() pyfile.status.url = self.get_file_url() + + if self.no_slots: + raise Exception, "No free slots!" tries += 1 if tries > 5: @@ -113,20 +119,21 @@ class RapidshareCom(Plugin): """ 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[0] = self.req.load(url, cookies=True) self.html_old = time() def download_serverhtml(self): """downloads html with the important informations """ file_server_url = re.search(r"<form action=\"(.*?)\"", self.html[0]).group(1) - self.html[1] = self.req.load(file_server_url, None, {"dl.start": "Free"}) + self.html[1] = self.req.load(file_server_url, cookies=True, post={"dl.start": "Free"}) self.html_old = time() self.get_wait_time() def get_wait_time(self): if re.search(r"is already downloading", self.html[1]) != None: self.time_plus_wait = time() + 10 * 60 + self.no_slots = False try: wait_minutes = re.search(r"Or try again in about (\d+) minute", self.html[1]).group(1) self.time_plus_wait = time() + 60 * int(wait_minutes) @@ -134,6 +141,8 @@ class RapidshareCom(Plugin): except: if re.search(r"(Currently a lot of users|There are no more download slots)", self.html[1], re.I) != None: self.time_plus_wait = time() + 130 + self.parent.parent.logger.debug("Rapidshare: No free slots!") + self.no_slots = True return True wait_seconds = re.search(r"var c=(.*);.*", self.html[1]).group(1) self.time_plus_wait = time() + int(wait_seconds) + 5 @@ -161,7 +170,11 @@ class RapidshareCom(Plugin): # self.download_serverhtml() try: + if self.no_slots: + self.start_dl = False + return False if self.api_data and self.api_data["mirror"]: + self.start_dl = True return self.api_data["mirror"] if self.config['server'] == "": file_url_pattern = r".*name=\"dlf\" action=\"(.*)\" method=.*" |