summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-11-13 22:06:22 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-11-13 22:06:22 +0100
commit64a3d2b06ab4929c1df3d832ef9a12b8228ffc7c (patch)
treefbe47abde6b894fa48103860d70dc493e4f68fb6 /module/plugins
parentbugfix (diff)
downloadpyload-64a3d2b06ab4929c1df3d832ef9a12b8228ffc7c.tar.xz
tried to fix rapidshare free slot problem
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/RapidshareCom.py19
1 files changed, 16 insertions, 3 deletions
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=.*"