diff options
Diffstat (limited to 'module/plugins/accounts/RehostTo.py')
-rw-r--r-- | module/plugins/accounts/RehostTo.py | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index c4aa85484..00a45dedd 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -4,32 +4,42 @@ from module.plugins.Account import Account class RehostTo(Account): - __name__ = "RehostTo" - __version__ = "0.1" - __type__ = "account" + __name__ = "RehostTo" + __type__ = "account" + __version__ = "0.11" + __description__ = """Rehost.to account plugin""" - __author_name__ = "RaNaN" - __author_mail__ = "RaNaN@pyload.org" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] + def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data["password"])) - data = [x.split("=") for x in page.split(",")] + html = req.load("http://rehost.to/api.php", + get={'cmd': "login", 'user': user, 'pass': data['password']}) + data = [x.split("=") for x in html.split(",")] ses = data[0][1] long_ses = data[1][1] - page = req.load("http://rehost.to/api.php?cmd=get_premium_credits&long_ses=%s" % long_ses) - traffic, valid = page.split(",") + html = req.load("http://rehost.to/api.php", + get={'cmd': "get_premium_credits", 'long_ses': long_ses}) + + traffic, valid = html.split(",") - account_info = {"trafficleft": int(traffic) * 1024, - "validuntil": int(valid), - "long_ses": long_ses, - "ses": ses} + trafficleft = self.parseTraffic(traffic + "MB") + validuntil = float(valid) + + account_info = {"trafficleft": trafficleft, + "validuntil" : validuntil, + "long_ses" : long_ses, + "ses" : ses} return account_info + def login(self, user, data, req): - page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data["password"])) + html = req.load("http://rehost.to/api.php", + get={'cmd': "login", 'user': user, 'pass': data['password']}) - if "Login failed." in page: + if "Login failed." in html: self.wrongPassword() |