From 16af85004c84d0d6c626b4f8424ce9647669a0c1 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 9 Jun 2013 18:10:22 +0200 Subject: moved everything from module to pyload --- pyload/plugins/accounts/ShareRapidCom.py | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 pyload/plugins/accounts/ShareRapidCom.py (limited to 'pyload/plugins/accounts/ShareRapidCom.py') diff --git a/pyload/plugins/accounts/ShareRapidCom.py b/pyload/plugins/accounts/ShareRapidCom.py new file mode 100644 index 000000000..f8043449c --- /dev/null +++ b/pyload/plugins/accounts/ShareRapidCom.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +import re +from time import mktime, strptime +from module.plugins.Account import Account + +class ShareRapidCom(Account): + __name__ = "ShareRapidCom" + __version__ = "0.32" + __type__ = "account" + __description__ = """ShareRapid account plugin""" + __author_name__ = ("MikyWoW", "zoidberg") + + login_timeout = 60 + + def loadAccountInfo(self, user, req): + src = req.load("http://share-rapid.com/mujucet/", decode=True) + + found = re.search(ur'Max. počet paralelních stahování: (\d+)', src) + if found: + data = self.getAccountData(user) + data["options"]["limitDL"] = [int(found.group(1))] + + found = re.search(ur'Paušální stahování aktivní. Vyprší (.*?)', src) + if found: + validuntil = mktime(strptime(found.group(1), "%d.%m.%Y - %H:%M")) + return {"premium": True, "trafficleft": -1, "validuntil": validuntil} + + found = re.search(r'GB:(.*?) GB', src) + if found: + trafficleft = float(found.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://share-rapid.com/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://share-rapid.com/prihlaseni/", + post={"hash": hashes, + "login": user, + "pass1": data["password"], + "remember": 0, + "sbmt": u"Přihlásit"}, cookies=True) \ No newline at end of file -- cgit v1.2.3