summaryrefslogtreecommitdiffstats
path: root/Plugins/RapidshareCom.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-28 12:52:56 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-28 12:52:56 +0200
commitc9eb7081bbd4cedf9a6574c39ceb0cfde1083113 (patch)
tree7c3e26941ccf347c6a1571b155cc8ef1cc2d685c /Plugins/RapidshareCom.py
parentfexed little bug (diff)
downloadpyload-c9eb7081bbd4cedf9a6574c39ceb0cfde1083113.tar.xz
clean up some code, new config parser, basic time shedule
Diffstat (limited to 'Plugins/RapidshareCom.py')
-rw-r--r--Plugins/RapidshareCom.py42
1 files changed, 20 insertions, 22 deletions
diff --git a/Plugins/RapidshareCom.py b/Plugins/RapidshareCom.py
index 694fa29c9..8f774937b 100644
--- a/Plugins/RapidshareCom.py
+++ b/Plugins/RapidshareCom.py
@@ -1,27 +1,25 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
-import urllib2
-import urllib
import re
import time
+from time import time
from Plugin import Plugin
-from time import time
class RapidshareCom(Plugin):
def __init__(self, parent):
Plugin.__init__(self, parent)
- plugin_config = {}
- plugin_config['name'] = "RapidshareCom"
- plugin_config['type'] = "hoster"
- plugin_config['pattern'] = r"http://(?:www.)?rapidshare.com/files/"
- plugin_config['version'] = "0.1"
- plugin_config['description'] = """Rapidshare.com Download Plugin"""
- plugin_config['author_name'] = ("spoob")
- plugin_config['author_mail'] = ("spoob@pyload.org")
- self.plugin_config = plugin_config
+ props = {}
+ props['name'] = "RapidshareCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www.)?rapidshare.com/files/"
+ props['version'] = "0.1"
+ props['description'] = """Rapidshare.com Download Plugin"""
+ props['author_name'] = ("spoob")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
self.parent = parent
self.html = [None, None]
self.html_old = None #time() where loaded the HTML
@@ -57,7 +55,7 @@ class RapidshareCom(Plugin):
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[1] = self.req.load(file_server_url, None,{"dl.start" : "Free"})
+ self.html[1] = self.req.load(file_server_url, None, {"dl.start": "Free"})
self.html_old = time()
self.get_wait_time()
@@ -65,17 +63,17 @@ class RapidshareCom(Plugin):
def get_wait_time(self):
if self.html[1] == None:
- download_serverhtml(self)
+ self.download_serverhtml(self)
if re.search(r".*is already downloading.*", self.html[1]) != None:
- self.time_plus_wait = time() + 10*60
+ self.time_plus_wait = time() + 10 * 60
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)
self.want_reconnect = True
except:
if re.search(r".*Currently a lot of users.*", self.html[1]) != None:
- self.time_plus_wait = time() + 2*60
+ self.time_plus_wait = time() + 2 * 60
wait_seconds = re.search(r"var c=(.*);.*", self.html[1]).group(1)
self.time_plus_wait = time() + int(wait_seconds) + 5
@@ -85,10 +83,10 @@ class RapidshareCom(Plugin):
if self.html[0] == None:
self.download_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]) or \
- re.search(r"(.*This file is suspected to contain illegal content.*)", self.html[0]):
+ 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]) or \
+ re.search(r"(.*This file is suspected to contain illegal content.*)", self.html[0]):
return False
else:
return True
@@ -98,7 +96,7 @@ class RapidshareCom(Plugin):
"""
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
+ 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:
@@ -122,4 +120,4 @@ class RapidshareCom(Plugin):
return self.time_plus_wait
def __call__(self):
- return self.plugin_config['name']
+ return self.props['name']