summaryrefslogtreecommitdiffstats
path: root/pyload/plugin/account/RehostTo.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugin/account/RehostTo.py')
-rw-r--r--pyload/plugin/account/RehostTo.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/pyload/plugin/account/RehostTo.py b/pyload/plugin/account/RehostTo.py
new file mode 100644
index 000000000..3b02145fc
--- /dev/null
+++ b/pyload/plugin/account/RehostTo.py
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+
+from pyload.plugin.Account import Account
+
+
+class RehostTo(Account):
+ __name = "RehostTo"
+ __type = "account"
+ __version = "0.16"
+
+ __description = """Rehost.to account plugin"""
+ __license = "GPLv3"
+ __authors = [("RaNaN", "RaNaN@pyload.org")]
+
+
+ def loadAccountInfo(self, user, req):
+ premium = False
+ trafficleft = None
+ validuntil = -1
+ session = ""
+
+ html = req.load("http://rehost.to/api.php",
+ 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" 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']},
+ decode=True)
+
+ if "ERROR" in html:
+ self.logDebug(html)
+ self.wrongPassword()