diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-12-29 11:44:24 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-12-29 11:44:24 +0100 |
commit | 31c5e0c1cbb6da955973bdce360eedbe61225688 (patch) | |
tree | 0170556dd7528723c803fb1c299199aca143ab24 /module/plugins | |
parent | more fixes and chunk+resume debug (diff) | |
download | pyload-31c5e0c1cbb6da955973bdce360eedbe61225688.tar.xz |
fixed accounts
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/Account.py | 6 | ||||
-rw-r--r-- | module/plugins/accounts/DepositfilesCom.py | 6 | ||||
-rw-r--r-- | module/plugins/accounts/FileserveCom.py | 6 | ||||
-rw-r--r-- | module/plugins/accounts/FreakshareCom.py | 4 | ||||
-rw-r--r-- | module/plugins/accounts/HotfileCom.py | 6 | ||||
-rw-r--r-- | module/plugins/accounts/MegauploadCom.py | 4 | ||||
-rw-r--r-- | module/plugins/accounts/NetloadIn.py | 4 | ||||
-rw-r--r-- | module/plugins/accounts/RapidshareCom.py | 4 | ||||
-rw-r--r-- | module/plugins/accounts/ShareonlineBiz.py | 4 | ||||
-rw-r--r-- | module/plugins/accounts/UploadedTo.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/MultiHome.py | 6 |
11 files changed, 28 insertions, 26 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py index 0c2bcb770..29c5f93b8 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -110,6 +110,7 @@ class Account(): "valid": self.accounts[name]["valid"], "trafficleft": None, # in kb, -1 for unlimited "maxtraffic": None, + "premium": True, #useful for free accounts "type": self.__name__, } @@ -143,14 +144,15 @@ class Account(): for user,data in self.accounts.iteritems(): if not data["valid"]: continue - if data["options"].has_key("time"): + if data["options"].has_key("time") and data["options"]["time"]: + time_data = "" try: time_data = data["options"]["time"][0] start, end = time_data.split("-") if not self.core.compare_time(start.split(":"), end.split(":")): continue except: - self.core.log.error(_("Your Time %s has wrong format, use: 1:22-3:44") % time) + self.core.log.warning(_("Your Time %s has wrong format, use: 1:22-3:44") % time_data) if self.infos.has_key(user): if self.infos[user].has_key("validuntil"): diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index b33083da9..b0730de8e 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -31,7 +31,7 @@ class DepositfilesCom(Account): def loadAccountInfo(self, user, req): - src = req.getPage("http://depositfiles.com/de/gold/") + src = req.load("http://depositfiles.com/de/gold/") validuntil = re.search("noch den Gold-Zugriff: <b>(.*?)</b></div>", src).group(1) validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) @@ -41,7 +41,7 @@ class DepositfilesCom(Account): def login(self, user, data, req): - req.getPage("http://depositfiles.com/de/gold/payment.php") - src = req.getPage("http://depositfiles.com/de/login.php", get={"return": "/de/gold/payment.php"}, post={"login": user, "password": data["password"]}) + req.load("http://depositfiles.com/de/gold/payment.php") + src = req.load("http://depositfiles.com/de/login.php", get={"return": "/de/gold/payment.php"}, post={"login": user, "password": data["password"]}) if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in src: self.wrongPassword() diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 76fc485ed..7754de253 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -31,7 +31,7 @@ class FileserveCom(Account): def loadAccountInfo(self, user, req): - src = req.getPage("http://fileserve.com/dashboard.php", cookies=True) + src = req.load("http://fileserve.com/dashboard.php", cookies=True) m = re.search(r"<td><h4>Premium Until</h4></th> <td><h5>(.*?) E(.)T</h5></td>", src) if m: @@ -44,12 +44,12 @@ class FileserveCom(Account): def login(self, user, data, req): - html = req.getPage("http://fileserve.com/login.php", + html = req.load("http://fileserve.com/login.php", post={"loginUserName": user, "loginUserPassword": data["password"], "autoLogin": "on", "loginFormSubmit": "Login"}, cookies=True) if r'Please Enter a valid user name.' in html: self.wrongPassword() - req.getPage("http://fileserve.com/dashboard.php", cookies=True) + req.load("http://fileserve.com/dashboard.php", cookies=True) diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index fcab247cb..732f9e203 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -30,7 +30,7 @@ class FreakshareCom(Account): __author_mail__ = ("RaNaN@pyload.org") def loadAccountInfo(self, user, req): - page = req.getPage("http://freakshare.com/") + page = req.load("http://freakshare.com/") validuntil = r"ltig bis:</td>\s*<td><b>([0-9 \-:.]+)</b></td>" validuntil = re.search(validuntil, page, re.MULTILINE) @@ -45,7 +45,7 @@ class FreakshareCom(Account): return {"validuntil": validuntil, "trafficleft": traffic} def login(self, user, data, req): - page = req.getPage("http://freakshare.com/login.html", None, { "submit" : "Login", "user" : user, "pass" : data['password']}, cookies=True) + 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: self.wrongPassword() diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py index 579267af3..42b8274b1 100644 --- a/module/plugins/accounts/HotfileCom.py +++ b/module/plugins/accounts/HotfileCom.py @@ -57,7 +57,7 @@ class HotfileCom(Account): req = self.getAccountRequest(user) - digest = req.getPage("http://api.hotfile.com/", post={"action":"getdigest"}) + digest = req.load("http://api.hotfile.com/", post={"action":"getdigest"}) h = hashlib.md5() h.update(data["password"]) hp = h.hexdigest() @@ -68,7 +68,7 @@ class HotfileCom(Account): post.update({"action": method}) post.update({"username":user, "passwordmd5dig":pwhash, "digest":digest}) - resp = req.getPage("http://api.hotfile.com/", post=post) + resp = req.load("http://api.hotfile.com/", post=post) req.clean() return resp @@ -76,7 +76,7 @@ class HotfileCom(Account): cj = self.getAccountCookies(user) cj.setCookie("hotfile.com", "lang", "en") req.load("http://hotfile.com/", cookies=True) - page = req.getPage("http://hotfile.com/login.php", post={"returnto": "/", "user": user, "pass": data["password"]}, cookies=True) + page = req.load("http://hotfile.com/login.php", post={"returnto": "/", "user": user, "pass": data["password"]}, cookies=True) if "Bad username/password" in page: self.wrongPassword() diff --git a/module/plugins/accounts/MegauploadCom.py b/module/plugins/accounts/MegauploadCom.py index d50008b70..3432c299a 100644 --- a/module/plugins/accounts/MegauploadCom.py +++ b/module/plugins/accounts/MegauploadCom.py @@ -31,7 +31,7 @@ class MegauploadCom(Account): __author_mail__ = ("RaNaN@pyload.org") def loadAccountInfo(self, user, req): - page = req.getPage("http://www.megaupload.com/?c=account") + page = req.load("http://www.megaupload.com/?c=account") free = re.findall(r"Account type:</TD>\s*<TD><b>Regular</b>",page,re.IGNORECASE+re.MULTILINE) if free: @@ -47,6 +47,6 @@ class MegauploadCom(Account): def login(self, user, data, req): - page = req.getPage("http://www.megaupload.com/?c=login&next=c%3Dpremium", post={ "username" : user, "password" : data["password"], "login" :"1"}, cookies=True) + 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() diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 89e4c0037..4f5b08689 100644 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -30,13 +30,13 @@ class NetloadIn(Account): __author_mail__ = ("RaNaN@pyload.org") def loadAccountInfo(self, user, req): - page = req.getPage("http://netload.in/index.php?id=2") + 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): - page = req.getPage("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True) + 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 e4472a4db..a2bb30211 100644 --- a/module/plugins/accounts/RapidshareCom.py +++ b/module/plugins/accounts/RapidshareCom.py @@ -31,7 +31,7 @@ class RapidshareCom(Account): data = self.getAccountData(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.getPage(api_url_base, cookies=False, get=api_param_prem) + src = req.load(api_url_base, cookies=False, get=api_param_prem) if src.startswith("ERROR"): raise Exception(src) fields = src.split("\n") @@ -51,7 +51,7 @@ class RapidshareCom(Account): 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.getPage(api_url_base, cookies=False, get=api_param_prem) + src = req.load(api_url_base, cookies=False, get=api_param_prem) if src.startswith("ERROR"): raise Exception(src+"### Note you have to use your account number for login, instead of name.") fields = src.split("\n") diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index e868b65b2..3564d489c 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -30,7 +30,7 @@ class ShareonlineBiz(Account): __author_mail__ = ("mkaay@mkaay.de") def loadAccountInfo(self, user, req): - src = req.getPage("http://www.share-online.biz/members.php?setlang=en") + 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"))) @@ -47,4 +47,4 @@ class ShareonlineBiz(Account): "login": "Login" } req.lastURL = "http://www.share-online.biz/" - req.getPage("https://www.share-online.biz/login.php", cookies=True, post=post_vars) + req.load("https://www.share-online.biz/login.php", cookies=True, post=post_vars) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 9b17debf5..b432bf98a 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -31,7 +31,7 @@ class UploadedTo(Account): __author_mail__ = ("mkaay@mkaay.de") def loadAccountInfo(self, user, req): - html = req.getPage("http://uploaded.to/", cookies=True) + html = req.load("http://uploaded.to/", 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) traffic = int(self.parseTraffic(raw_traffic)) @@ -42,6 +42,6 @@ class UploadedTo(Account): def login(self, user, data, req): req.cookieJar.set_cookie(Cookie(version=0, name='lang', value='en', port=None, port_specified=False, domain='.uploaded.to', domain_specified=True, domain_initial_dot=True, path='/', path_specified=True, secure=False, expires=None, discard=False, comment=None, comment_url=None, rest={}, rfc2109=False)) - page = req.getPage("http://uploaded.to/login", post={ "email" : user, "password" : data["password"]}) + page = req.load("http://uploaded.to/login", post={ "email" : user, "password" : data["password"]}) if "Login failed!" in page: self.wrongPassword() diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 4678412bf..68ad02181 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -47,13 +47,13 @@ class MultiHome(Hook): self.interfaces.append(Interface(interface)) def coreReady(self): - requestFactory = self.core.requestFactory - oldGetRequest = requestFactory.getRequest + requestFactory = self.core.requestFactory + oldGetRequest = requestFactory.getRequest def getRequest(pluginName, account=None): iface = self.bestInterface(pluginName, account) if iface: iface.useFor(pluginName, account) - requestFactory.iface = iface.adress + requestFactory.iface = lambda self: iface.adress self.log.debug("Multihome: using address: "+iface.adress) return oldGetRequest(pluginName, account) requestFactory.getRequest = getRequest |