summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/account/ShareRapidCom.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-03 19:58:02 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-03 19:58:02 +0200
commit43e6a6376625ac73067403ddae3b45a80618d6c8 (patch)
treeceb458c3da1f19e0a91731bc254ee3a158682d0b /pyload/plugins/account/ShareRapidCom.py
parent[ConfigParser] Remove IGNORE feature (diff)
downloadpyload-43e6a6376625ac73067403ddae3b45a80618d6c8.tar.xz
Rename accounts directory to account
Diffstat (limited to 'pyload/plugins/account/ShareRapidCom.py')
-rw-r--r--pyload/plugins/account/ShareRapidCom.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/pyload/plugins/account/ShareRapidCom.py b/pyload/plugins/account/ShareRapidCom.py
new file mode 100644
index 000000000..2cd955bbe
--- /dev/null
+++ b/pyload/plugins/account/ShareRapidCom.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from time import mktime, strptime
+from pyload.plugins.base.Account import Account
+
+
+class ShareRapidCom(Account):
+ __name__ = "ShareRapidCom"
+ __type__ = "account"
+ __version__ = "0.34"
+
+ __description__ = """MegaRapid.cz account plugin"""
+ __author_name__ = ("MikyWoW", "zoidberg")
+ __author_mail__ = ("mikywow@seznam.cz", "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)