diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-10 19:28:37 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-10 19:28:37 +0100 |
commit | 222f9aff3f2e06670a9e2d1377bbf45e6e57b51e (patch) | |
tree | 657a371bac71ce151071bb42c18a936d131a83f2 /pyload/plugins/account/RapiduNet.py | |
parent | Fix plugins key attributes (diff) | |
download | pyload-222f9aff3f2e06670a9e2d1377bbf45e6e57b51e.tar.xz |
[RapiduNet] Improve account plugin
Diffstat (limited to 'pyload/plugins/account/RapiduNet.py')
-rw-r--r-- | pyload/plugins/account/RapiduNet.py | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/pyload/plugins/account/RapiduNet.py b/pyload/plugins/account/RapiduNet.py index 127aceb3b..d2ea11e34 100644 --- a/pyload/plugins/account/RapiduNet.py +++ b/pyload/plugins/account/RapiduNet.py @@ -7,40 +7,42 @@ from pyload.utils import json_loads class RapiduNet(Account): - __name = "RapiduNet" - __type = "account" - __version = "0.01" + __name = "RapiduNet" + __type = "account" + __version = "0.02" __description = """Rapidu.net account plugin""" - __license = "GPLv3" - __authors = [("prOq", None)] + __license = "GPLv3" + __authors = [("prOq", None)] - ACCOUNT_INFO_PATTERN = '<a href="premium/" style="padding-left: 0px;">Account: <b>(.*?)</b></a>' + PREMIUM_PATTERN = r'<a href="premium/" style="padding-left: 0px;">Account: <b>Premium</b></a>' def loadAccountInfo(self, user, req): - premium = False + info = {'validuntil': None, 'trafficleft': None, 'premium': False} - req.load('https://rapidu.net/ajax.php?a=getChangeLang', post={"_go": "", "lang": "en"}) - self.html = req.load('https://rapidu.net/', decode=True) + req.load("https://rapidu.net/ajax.php", get={'a': "getChangeLang"}, post={"_go": "", "lang": "en"}) + html = req.load("https://rapidu.net/", decode=True) - m = re.search(self.ACCOUNT_INFO_PATTERN, self.html) - if m: - if m.group(1) == "Premium": - premium = True + if re.search(self.PREMIUM_PATTERN, html): + info['premium'] = True - return {"validuntil": None, "trafficleft": None, "premium": premium} + return info def login(self, user, data, req): try: - json = req.load('https://rapidu.net/ajax.php?a=getUserLogin', post={"_go": "", "login": user, "pass": data['password'], "member": "1"}) - json = json_loads(json) + json = json_loads(req.load("https://rapidu.net/ajax.php?a=getUserLogin", + post={'_go': "", + 'login': user, + 'pass': data['password'], + 'member': "1"})) + self.logDebug(json) if not json['message'] == "success": - self.wrongPassword() + self.wrongPassword() + except Exception, e: self.logError(e) - |