summaryrefslogtreecommitdiffstats
path: root/Plugins
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-19 16:26:37 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-19 16:26:37 +0200
commitb44f560c3a53c073a1290e3403ff76ebbe35e91b (patch)
tree595a55d2acd0670a313c58f0263dd3c15050e80a /Plugins
parentrapidshare waits (diff)
downloadpyload-b44f560c3a53c073a1290e3403ff76ebbe35e91b.tar.xz
RapidshareCom läuft jetzt wieder.
Diffstat (limited to 'Plugins')
-rw-r--r--Plugins/RapidshareCom.py66
1 files changed, 41 insertions, 25 deletions
diff --git a/Plugins/RapidshareCom.py b/Plugins/RapidshareCom.py
index e075ecfc7..6f81a9549 100644
--- a/Plugins/RapidshareCom.py
+++ b/Plugins/RapidshareCom.py
@@ -25,7 +25,8 @@ class RapidshareCom(Plugin):
pluginProp ['author_email'] = "nn@nn.de"
self.pluginProp = pluginProp
self.parent = parent
- self.html = None
+ self.html = [None, None]
+ self.prehtml = None
self.html_old = None #time() where loaded the HTML
self.time_plus_wait = None #time() + wait in seconds
self.want_reconnect = False
@@ -33,46 +34,62 @@ class RapidshareCom(Plugin):
def set_parent_status(self):
""" sets all available Statusinfos about a File in self.parent.status
"""
- if self.html == None:
+ if self.html[0] == None:
self.download_html()
+
+ self.get_wait_time()
self.parent.status.filename = self.get_file_name()
self.parent.status.url = self.get_file_url()
- self.parent.status.wait = self.wait_until()
+ self.parent.status.waituntil = self.wait_until()
def download_html(self):
""" gets the url from self.parent.url saves html in self.html and parses
"""
url = self.parent.url
html = urllib2.urlopen(url).read()
- self.html = html
+ self.html[0] = html
self.html_old = time()
- def get_wait_time(self):
- file_server_url = re.search(r"<form action=\"(.*?)\"", self.html).group(1)
+ def download_serverhtml(self):
+ """downloads html with the important informations
+ """
+ if self.html[0] == None:
+ self.download_html()
+
+ file_server_url = re.search(r"<form action=\"(.*?)\"", self.html[0]).group(1)
#free user
free_user_encode = urllib.urlencode({"dl.start" : "Free"})
- self.html = urllib2.urlopen(file_server_url, free_user_encode).read()
- if re.search(r".*is already downloading.*", self.html) != None:
+ self.html[1] = urllib2.urlopen(file_server_url, free_user_encode).read()
+ self.html_old = time()
+ self.get_wait_time()
+
+
+ def get_wait_time(self):
+
+ if self.html[1] == None:
+ download_serverhtml(self)
+
+ if re.search(r".*is already downloading.*", self.html[1]) != None:
self.time_plus_wait = time() + 10*60
try:
- wait_minutes = re.search(r"Or try again in about (\d+) minute", self.html).group(1)
+ 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)
self.want_reconnect = True
except:
- if re.search(r".*Currently a lot of users.*", self.html) != None:
+ if re.search(r".*Currently a lot of users.*", self.html[1]) != None:
self.time_plus_wait = time() + 2*60
- wait_seconds = re.search(r"var c=(.*);.*", self.html).group(1)
+ wait_seconds = re.search(r"var c=(.*);.*", self.html[1]).group(1)
self.time_plus_wait = time() + int(wait_seconds) + 5
def file_exists(self):
""" returns True or False
"""
- if self.html == None:
+ if self.html[0] == None:
self.download_html()
- if re.search(r".*The File could not be found.*", self.html) != None or \
- re.search(r"(<p>This limit is reached.</p>)", self.html) or \
- re.search(r"(.*is momentarily not available.*)", self.html) or \
- re.search(r"(.*The uploader has removed this file from the server.*)", self.html):
+ if re.search(r".*The File could not be found.*", self.html[0]) != None or \
+ re.search(r"(<p>This limit is reached.</p>)", self.html[0]) or \
+ re.search(r"(.*is momentarily not available.*)", self.html[0]) or \
+ re.search(r"(.*The uploader has removed this file from the server.*)", self.html[0]):
return False
else:
return True
@@ -80,24 +97,23 @@ class RapidshareCom(Plugin):
def get_file_url(self):
""" returns the absolute downloadable filepath
"""
- se.get_wait_time()
- if self.html == None:
- self.download_html()
- if (self.html_old + 5*60) > time(): # nach einiger zeit ist die file_url nicht mehr aktuell
- self.download_html()
+ if self.html[1] == None:
+ self.download_serverhtml()
+ if (self.html_old + 5*60) < time(): # nach einiger zeit ist die file_url nicht mehr aktuell
+ self.download_serverhtml()
if not self.want_reconnect:
file_url_pattern = r".*name=\"dlf\" action=\"(.*)\" method=.*"
- return re.search(file_url_pattern, self.html).group(1)
+ return re.search(file_url_pattern, self.html[1]).group(1)
else:
return False
def get_file_name(self):
- if self.html == None:
- self.download_html()
+ if self.html[1] == None:
+ self.download_serverhtml()
if not self.want_reconnect:
file_name_pattern = r".*name=\"dlf\" action=\"(.*)\" method=.*"
- return re.search(file_name_pattern, self.html).group(1).split('/')[-1]
+ return re.search(file_name_pattern, self.html[1]).group(1).split('/')[-1]
else:
return self.parent.url