summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/RehostTo.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-18 16:02:29 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-18 16:02:29 +0100
commitfb65d5354c3cc80c3f48c3a2745b8dc01105edfd (patch)
tree822240f20e27f2d5edc3e10624fc622e7c26cdc6 /module/plugins/accounts/RehostTo.py
parent[UploadedTo] Fix trafficleft recognition (diff)
downloadpyload-fb65d5354c3cc80c3f48c3a2745b8dc01105edfd.tar.xz
Update account plugins
Diffstat (limited to 'module/plugins/accounts/RehostTo.py')
-rw-r--r--module/plugins/accounts/RehostTo.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py
index eec7d8731..00a45dedd 100644
--- a/module/plugins/accounts/RehostTo.py
+++ b/module/plugins/accounts/RehostTo.py
@@ -6,7 +6,7 @@ from module.plugins.Account import Account
class RehostTo(Account):
__name__ = "RehostTo"
__type__ = "account"
- __version__ = "0.10"
+ __version__ = "0.11"
__description__ = """Rehost.to account plugin"""
__license__ = "GPLv3"
@@ -15,27 +15,31 @@ class RehostTo(Account):
def loadAccountInfo(self, user, req):
data = self.getAccountData(user)
- page = req.load("http://rehost.to/api.php",
+ html = req.load("http://rehost.to/api.php",
get={'cmd': "login", 'user': user, 'pass': data['password']})
- data = [x.split("=") for x in page.split(",")]
+ 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",
+ html = req.load("http://rehost.to/api.php",
get={'cmd': "get_premium_credits", 'long_ses': long_ses})
- traffic, valid = page.split(",")
- account_info = {"trafficleft": int(traffic) * 1024,
- "validuntil": int(valid),
- "long_ses": long_ses,
- "ses": ses}
+ traffic, valid = html.split(",")
+
+ 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",
+ 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()