summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/plugins/Account.py16
-rw-r--r--module/plugins/Plugin.py3
-rw-r--r--module/plugins/accounts/DepositfilesCom.py7
-rw-r--r--module/plugins/accounts/FileserveCom.py7
-rw-r--r--module/plugins/accounts/FreakshareCom.py6
-rw-r--r--module/plugins/accounts/HotfileCom.py9
-rw-r--r--module/plugins/accounts/MegauploadCom.py6
-rw-r--r--module/plugins/accounts/NetloadIn.py6
-rw-r--r--module/plugins/accounts/RapidshareCom.py6
-rw-r--r--module/plugins/accounts/ShareonlineBiz.py6
-rw-r--r--module/plugins/accounts/UploadedTo.py6
11 files changed, 37 insertions, 41 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index 19ab8f4ba..c630a47df 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -40,12 +40,13 @@ class Account():
self.infos = {} # cache for account information
self.setAccounts(accounts)
- def login(self, user, data):
+ def login(self, user, data, req):
pass
def _login(self, user, data):
+ req = self.getAccountRequest(user)
try:
- self.login(user, data)
+ self.login(user, data, req)
except WrongPassword:
self.core.log.warning(_("Could not login with %(plugin)s account %(user)s | %(msg)s") % {"plugin": self.__name__, "user": user, "msg": _("Wrong Password")})
data["valid"] = False
@@ -55,6 +56,8 @@ class Account():
data["valid"] = False
if self.core.debug:
print_exc()
+ finally:
+ req.clean()
def setAccounts(self, accounts):
self.accounts = accounts
@@ -84,19 +87,24 @@ class Account():
data = Account.loadAccountInfo(self, name)
if not self.infos.has_key(name) or force:
self.core.log.debug("Get %s Account Info for %s" % (self.__name__, name))
+ req = self.getAccountRequest(name)
+
try:
- infos = self.loadAccountInfo(name)
+ infos = self.loadAccountInfo(name, req)
if not type(infos) == dict:
raise Exception("Wrong return format")
except Exception, e:
infos = {"error": str(e)}
+ finally:
+ req.clean()
+
self.core.log.debug("Account Info: %s" % str(infos))
self.infos[name] = infos
data.update(self.infos[name])
return data
- def loadAccountInfo(self, name):
+ def loadAccountInfo(self, name, req=None):
return {
"validuntil": None, # -1 for unlimited
"login": name,
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index 0df3519fc..267ce57d5 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -109,7 +109,7 @@ class Plugin(object):
self.lastDownload = "" # location where the last call to download was saved
self.js = self.core.js # js engine
- self.setup()
+ #self.setup()
def __call__(self):
return self.__name__
@@ -126,6 +126,7 @@ class Plugin(object):
def preprocessing(self, thread):
""" handles important things to do before starting """
+ self.setup()
self.thread = thread
if self.account:
diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py
index 70741da0b..4a5792c40 100644
--- a/module/plugins/accounts/DepositfilesCom.py
+++ b/module/plugins/accounts/DepositfilesCom.py
@@ -29,8 +29,7 @@ class DepositfilesCom(Account):
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- def loadAccountInfo(self, user):
- req = self.getAccountRequest(user)
+ def loadAccountInfo(self, user, req):
src = req.load("http://depositfiles.com/de/gold/")
validuntil = re.search("noch den Gold-Zugriff: <b>(.*?)</b></div>", src).group(1)
@@ -40,7 +39,7 @@ class DepositfilesCom(Account):
tmp = {"validuntil":validuntil, "trafficleft":-1}
return tmp
- def login(self, user, data):
- req = self.getAccountRequest(user)
+ def login(self, user, data, req):
+
req.load("http://depositfiles.com/de/gold/payment.php")
req.load("http://depositfiles.com/de/login.php", get={"return": "/de/gold/payment.php"}, post={"login": user, "password": data["password"]})
diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py
index 27cad18bd..793d240cc 100644
--- a/module/plugins/accounts/FileserveCom.py
+++ b/module/plugins/accounts/FileserveCom.py
@@ -29,8 +29,7 @@ class FileserveCom(Account):
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- def loadAccountInfo(self, user):
- req = self.getAccountRequest(user)
+ def loadAccountInfo(self, user, req):
src = req.load("http://fileserve.com/dashboard.php", cookies=True)
@@ -43,8 +42,8 @@ class FileserveCom(Account):
tmp = {"trafficleft":-1}
return tmp
- def login(self, user, data):
- req = self.getAccountRequest(user)
+ def login(self, user, data, req):
+
req.load("http://fileserve.com/login.php",
post={"loginUserName": user, "loginUserPassword": data["password"],
"autoLogin": "on", "loginFormSubmit": "Login"}, cookies=True)
diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py
index ba9566522..732f9e203 100644
--- a/module/plugins/accounts/FreakshareCom.py
+++ b/module/plugins/accounts/FreakshareCom.py
@@ -29,8 +29,7 @@ class FreakshareCom(Account):
__author_name__ = ("RaNaN")
__author_mail__ = ("RaNaN@pyload.org")
- def loadAccountInfo(self, user):
- req = self.getAccountRequest(user)
+ def loadAccountInfo(self, user, req):
page = req.load("http://freakshare.com/")
validuntil = r"ltig bis:</td>\s*<td><b>([0-9 \-:.]+)</b></td>"
@@ -45,8 +44,7 @@ class FreakshareCom(Account):
return {"validuntil": validuntil, "trafficleft": traffic}
- def login(self, user, data):
- req = self.getAccountRequest(user)
+ def login(self, user, data, req):
page = req.load("http://freakshare.com/login.html", None, { "submit" : "Login", "user" : user, "pass" : data['password']}, cookies=True)
if "Falsche Logindaten!" in page or "Wrong Username or Password!" in page:
diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py
index 52bff87fe..a4354eb2e 100644
--- a/module/plugins/accounts/HotfileCom.py
+++ b/module/plugins/accounts/HotfileCom.py
@@ -29,7 +29,7 @@ class HotfileCom(Account):
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- def loadAccountInfo(self, user):
+ def loadAccountInfo(self, user, req):
resp = self.apiCall("getuserinfo", user=user)
if resp.startswith("."):
self.core.debug("HotfileCom API Error: %s" % resp)
@@ -68,10 +68,11 @@ class HotfileCom(Account):
post.update({"action": method})
post.update({"username":user, "passwordmd5dig":pwhash, "digest":digest})
- return req.load("http://api.hotfile.com/", post=post)
+ resp = req.load("http://api.hotfile.com/", post=post)
+ req.clean()
+ return resp
- def login(self, user, data):
- req = self.getAccountRequest(user)
+ def login(self, user, data, req):
cj = self.getAccountCookies(user)
cj.setCookie("hotfile.com", "lang", "en")
req.load("http://hotfile.com/", cookies=True)
diff --git a/module/plugins/accounts/MegauploadCom.py b/module/plugins/accounts/MegauploadCom.py
index e50c62788..dce6fb088 100644
--- a/module/plugins/accounts/MegauploadCom.py
+++ b/module/plugins/accounts/MegauploadCom.py
@@ -30,8 +30,7 @@ class MegauploadCom(Account):
__author_name__ = ("RaNaN")
__author_mail__ = ("RaNaN@pyload.org")
- def loadAccountInfo(self, user):
- req = self.getAccountRequest(user)
+ def loadAccountInfo(self, user, req):
page = req.load("http://www.megaupload.com/?c=account")
if 'id="directdownloadstxt">Activate' in page:
@@ -43,8 +42,7 @@ class MegauploadCom(Account):
return {"validuntil": valid, "trafficleft": -1}
- def login(self, user, data):
- req = self.getAccountRequest(user)
+ def login(self, user, data, req):
page = req.load("http://www.megaupload.com/?c=login&next=c%3Dpremium", post={ "username" : user, "password" : data["password"], "login" :"1"}, cookies=True)
if "Username and password do not match" in page:
self.wrongPassword() \ No newline at end of file
diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py
index 16e06b688..957435b46 100644
--- a/module/plugins/accounts/NetloadIn.py
+++ b/module/plugins/accounts/NetloadIn.py
@@ -29,16 +29,14 @@ class NetloadIn(Account):
__author_name__ = ("RaNaN")
__author_mail__ = ("RaNaN@pyload.org")
- def loadAccountInfo(self, user):
- req = self.getAccountRequest(user)
+ def loadAccountInfo(self, user, req):
page = req.load("http://netload.in/index.php?id=2")
left = r">(\d+) Tage, (\d+) Stunden<"
left = re.search(left, page)
validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(2)) * 60 * 60
return {"validuntil": validuntil, "trafficleft": -1}
- def login(self, user, data):
- req = self.getAccountRequest(user)
+ def login(self, user, req):
page = req.load("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True)
if "password or it might be invalid!" in page:
self.wrongPassword()
diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py
index 683237674..a2bb30211 100644
--- a/module/plugins/accounts/RapidshareCom.py
+++ b/module/plugins/accounts/RapidshareCom.py
@@ -27,9 +27,8 @@ class RapidshareCom(Account):
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- def loadAccountInfo(self, user):
+ def loadAccountInfo(self, user, req):
data = self.getAccountData(user)
- req = self.getAccountRequest(user)
api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1}
src = req.load(api_url_base, cookies=False, get=api_param_prem)
@@ -49,8 +48,7 @@ class RapidshareCom(Account):
return tmp
- def login(self, user, data):
- req = self.getAccountRequest(user)
+ def login(self, user, data, req):
api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1}
src = req.load(api_url_base, cookies=False, get=api_param_prem)
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py
index 15a554db0..3564d489c 100644
--- a/module/plugins/accounts/ShareonlineBiz.py
+++ b/module/plugins/accounts/ShareonlineBiz.py
@@ -29,8 +29,7 @@ class ShareonlineBiz(Account):
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- def loadAccountInfo(self, user):
- req = self.getAccountRequest(user)
+ def loadAccountInfo(self, user, req):
src = req.load("http://www.share-online.biz/members.php?setlang=en")
validuntil = re.search(r'<td align="left"><b>Package Expire Date:</b></td>\s*<td align="left">(\d+/\d+/\d+)</td>', src).group(1)
validuntil = int(mktime(strptime(validuntil, "%m/%d/%y")))
@@ -38,8 +37,7 @@ class ShareonlineBiz(Account):
tmp = {"validuntil":validuntil, "trafficleft":-1}
return tmp
- def login(self, user, data):
- req = self.getAccountRequest(user)
+ def login(self, user, data, req):
post_vars = {
"act": "login",
"location": "index.php",
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py
index 4c45fb6fc..2cb447877 100644
--- a/module/plugins/accounts/UploadedTo.py
+++ b/module/plugins/accounts/UploadedTo.py
@@ -29,8 +29,7 @@ class UploadedTo(Account):
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- def loadAccountInfo(self, user):
- req = self.getAccountRequest(user)
+ def loadAccountInfo(self, user, req):
html = req.load("http://uploaded.to/?setlang=en", cookies=True)
raw_traffic = re.search(r"Traffic left: </span><span class=.*?>(.*?)</span>", html).group(1)
raw_valid = re.search(r"Valid until: </span> <span class=.*?>(.*?)</span>", html).group(1)
@@ -40,8 +39,7 @@ class UploadedTo(Account):
tmp = {"validuntil":validuntil, "trafficleft":traffic, "maxtraffic":100*1024*1024}
return tmp
- def login(self, user, data):
- req = self.getAccountRequest(user)
+ def login(self, user, data, req):
page = req.load("http://uploaded.to/login", post={ "email" : user, "password" : data["password"]}, cookies=True)
if "Login failed!" in page:
self.wrongPassword()