From 43e6a6376625ac73067403ddae3b45a80618d6c8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 3 Oct 2014 19:58:02 +0200 Subject: Rename accounts directory to account --- pyload/plugins/account/TurbobitNet.py | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 pyload/plugins/account/TurbobitNet.py (limited to 'pyload/plugins/account/TurbobitNet.py') diff --git a/pyload/plugins/account/TurbobitNet.py b/pyload/plugins/account/TurbobitNet.py new file mode 100644 index 000000000..ba172d67e --- /dev/null +++ b/pyload/plugins/account/TurbobitNet.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +import re +from time import mktime, strptime + +from pyload.plugins.base.Account import Account + + +class TurbobitNet(Account): + __name__ = "TurbobitNet" + __type__ = "account" + __version__ = "0.01" + + __description__ = """TurbobitNet account plugin""" + __author_name__ = "zoidberg" + __author_mail__ = "zoidberg@mujmail.cz" + + + def loadAccountInfo(self, user, req): + html = req.load("http://turbobit.net") + + m = re.search(r'Turbo Access to ([0-9.]+)', html) + if m: + premium = True + validuntil = mktime(strptime(m.group(1), "%d.%m.%Y")) + else: + premium = False + validuntil = -1 + + return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + + def login(self, user, data, req): + req.cj.setCookie("turbobit.net", "user_lang", "en") + + html = req.load("http://turbobit.net/user/login", post={ + "user[login]": user, + "user[pass]": data['password'], + "user[submit]": "Login"}) + + if not '