diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-09 13:12:12 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-09 13:12:12 +0200 |
commit | 6632ded30de12bc16644b26de2605ec6b3bdd42a (patch) | |
tree | 1c1f2ea4cd3ea275e01fcd524fd50c0a2b7e1d23 /module/plugins/accounts/MegaRapidCz.py | |
parent | Newline cosmetics (diff) | |
download | pyload-6632ded30de12bc16644b26de2605ec6b3bdd42a.tar.xz |
ShareRapidCom -> MegaRapidCz
Diffstat (limited to 'module/plugins/accounts/MegaRapidCz.py')
-rw-r--r-- | module/plugins/accounts/MegaRapidCz.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py new file mode 100644 index 000000000..5b7b41e2b --- /dev/null +++ b/module/plugins/accounts/MegaRapidCz.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +import re + +from time import mktime, strptime +from module.plugins.Account import Account + + +class MegaRapidCz(Account): + __name__ = "MegaRapidCz" + __type__ = "account" + __version__ = "0.34" + + __description__ = """MegaRapid.cz account plugin""" + __license__ = "GPLv3" + __authors__ = [("MikyWoW", "mikywow@seznam.cz"), + ("zoidberg", "zoidberg@mujmail.cz")] + + + login_timeout = 60 + + + def loadAccountInfo(self, user, req): + src = req.load("http://megarapid.cz/mujucet/", decode=True) + + m = re.search(ur'<td>Max. počet paralelních stahování: </td><td>(\d+)', src) + if m: + data = self.getAccountData(user) + data['options']['limitDL'] = [int(m.group(1))] + + m = re.search(ur'<td>Paušální stahování aktivní. Vyprší </td><td><strong>(.*?)</strong>', src) + if m: + validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) + return {"premium": True, "trafficleft": -1, "validuntil": validuntil} + + m = re.search(r'<tr><td>Kredit</td><td>(.*?) GiB', src) + if m: + trafficleft = float(m.group(1)) * (1 << 20) + return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} + + return {"premium": False, "trafficleft": None, "validuntil": None} + + def login(self, user, data, req): + htm = req.load("http://megarapid.cz/prihlaseni/", cookies=True) + if "Heslo:" in htm: + start = htm.index('id="inp_hash" name="hash" value="') + htm = htm[start + 33:] + hashes = htm[0:32] + htm = req.load("http://megarapid.cz/prihlaseni/", + post={"hash": hashes, + "login": user, + "pass1": data['password'], + "remember": 0, + "sbmt": u"Přihlásit"}, cookies=True) |