summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/RehostTo.py
diff options
context:
space:
mode:
authorGravatar Sahil Shekhawat <sahilshekhawat01@gmail.com> 2015-01-11 14:54:48 +0100
committerGravatar Sahil Shekhawat <sahilshekhawat01@gmail.com> 2015-01-11 14:54:48 +0100
commitd2b60b5ceb369814a0de41c8b8744b5c4ed81523 (patch)
tree6619e01fc0e5f281e4d28678ec565860a86784ec /module/plugins/accounts/RehostTo.py
parentupdated nitroflare.com's plugin (diff)
parentCode improvements (diff)
downloadpyload-d2b60b5ceb369814a0de41c8b8744b5c4ed81523.tar.xz
Merged with the updated nitroflare
Diffstat (limited to 'module/plugins/accounts/RehostTo.py')
-rw-r--r--module/plugins/accounts/RehostTo.py55
1 files changed, 32 insertions, 23 deletions
diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py
index 00a45dedd..4efe38cad 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.11"
+ __version__ = "0.15"
__description__ = """Rehost.to account plugin"""
__license__ = "GPLv3"
@@ -14,32 +14,41 @@ class RehostTo(Account):
def loadAccountInfo(self, user, req):
- data = self.getAccountData(user)
+ premium = False
+ trafficleft = None
+ validuntil = -1
+ session = ""
+
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]
-
- html = req.load("http://rehost.to/api.php",
- get={'cmd': "get_premium_credits", 'long_ses': long_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
+ get={'cmd' : "login", 'user': user,
+ 'pass': self.getAccountData(user)['password']})
+ try:
+ session = html.split(",")[1].split("=")[1]
+
+ html = req.load("http://rehost.to/api.php",
+ get={'cmd': "get_premium_credits", 'long_ses': session})
+
+ if html.strip() == "0,0" or "ERROR" not in html:
+ self.logDebug(html)
+ else:
+ traffic, valid = html.split(",")
+
+ premium = True
+ trafficleft = self.parseTraffic(traffic + "MB")
+ validuntil = float(valid)
+
+ finally:
+ return {'premium' : premium,
+ 'trafficleft': trafficleft,
+ 'validuntil' : validuntil,
+ 'session' : session}
def login(self, user, data, req):
html = req.load("http://rehost.to/api.php",
- get={'cmd': "login", 'user': user, 'pass': data['password']})
+ get={'cmd': "login", 'user': user, 'pass': data['password']},
+ decode=True)
- if "Login failed." in html:
+ if "ERROR" in html:
+ self.logDebug(html)
self.wrongPassword()