summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/account/FreakshareCom.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/FreakshareCom.py
parent[ConfigParser] Remove IGNORE feature (diff)
downloadpyload-43e6a6376625ac73067403ddae3b45a80618d6c8.tar.xz
Rename accounts directory to account
Diffstat (limited to 'pyload/plugins/account/FreakshareCom.py')
-rw-r--r--pyload/plugins/account/FreakshareCom.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/pyload/plugins/account/FreakshareCom.py b/pyload/plugins/account/FreakshareCom.py
new file mode 100644
index 000000000..9bc68e6b4
--- /dev/null
+++ b/pyload/plugins/account/FreakshareCom.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+
+import re
+from time import strptime, mktime
+
+from pyload.plugins.base.Account import Account
+
+
+class FreakshareCom(Account):
+ __name__ = "FreakshareCom"
+ __type__ = "account"
+ __version__ = "0.1"
+
+ __description__ = """Freakshare.com account plugin"""
+ __author_name__ = "RaNaN"
+ __author_mail__ = "RaNaN@pyload.org"
+
+
+ def loadAccountInfo(self, user, req):
+ page = req.load("http://freakshare.com/")
+
+ validuntil = r"ltig bis:</td>\s*<td><b>([0-9 \-:.]+)</b></td>"
+ validuntil = re.search(validuntil, page, re.MULTILINE)
+ validuntil = validuntil.group(1).strip()
+ validuntil = mktime(strptime(validuntil, "%d.%m.%Y - %H:%M"))
+
+ traffic = r"Traffic verbleibend:</td>\s*<td>([^<]+)"
+ traffic = re.search(traffic, page, re.MULTILINE)
+ traffic = traffic.group(1).strip()
+ traffic = self.parseTraffic(traffic)
+
+ return {"validuntil": validuntil, "trafficleft": traffic}
+
+ def login(self, user, data, req):
+ page = req.load("http://freakshare.com/login.html", None,
+ {"submit": "Login", "user": user, "pass": data['password']}, cookies=True)
+
+ if "Falsche Logindaten!" in page or "Wrong Username or Password!" in page:
+ self.wrongPassword()