summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/FreakshareCom.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-18 16:02:29 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-18 16:02:29 +0100
commitfb65d5354c3cc80c3f48c3a2745b8dc01105edfd (patch)
tree822240f20e27f2d5edc3e10624fc622e7c26cdc6 /module/plugins/accounts/FreakshareCom.py
parent[UploadedTo] Fix trafficleft recognition (diff)
downloadpyload-fb65d5354c3cc80c3f48c3a2745b8dc01105edfd.tar.xz
Update account plugins
Diffstat (limited to 'module/plugins/accounts/FreakshareCom.py')
-rw-r--r--module/plugins/accounts/FreakshareCom.py34
1 files changed, 21 insertions, 13 deletions
diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py
index 27e1e3a0a..576d835e2 100644
--- a/module/plugins/accounts/FreakshareCom.py
+++ b/module/plugins/accounts/FreakshareCom.py
@@ -10,7 +10,7 @@ from module.plugins.Account import Account
class FreakshareCom(Account):
__name__ = "FreakshareCom"
__type__ = "account"
- __version__ = "0.11"
+ __version__ = "0.12"
__description__ = """Freakshare.com account plugin"""
__license__ = "GPLv3"
@@ -18,26 +18,34 @@ class FreakshareCom(Account):
def loadAccountInfo(self, user, req):
- page = req.load("http://freakshare.com/")
+ premium = False
+ validuntil = None
+ trafficleft = None
- validuntil = r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>'
- validuntil = re.search(validuntil, page, re.M)
- validuntil = validuntil.group(1).strip()
- validuntil = mktime(strptime(validuntil, "%d.%m.%Y - %H:%M"))
+ html = req.load("http://freakshare.com/")
- traffic = r'Traffic verbleibend:</td>\s*<td>([^<]+)'
- traffic = re.search(traffic, page, re.M)
- traffic = traffic.group(1).strip()
- traffic = self.parseTraffic(traffic)
+ try:
+ m = re.search(r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>', html, re.M)
+ validuntil = mktime(strptime(m.group(1).strip(), "%d.%m.%Y - %H:%M"))
- return {"validuntil": validuntil, "trafficleft": traffic}
+ except Exception:
+ pass
+
+ try:
+ m = re.search(r'Traffic verbleibend:</td>\s*<td>([^<]+)', html, re.M)
+ trafficleft = self.parseTraffic(m.group(1))
+
+ except Exception:
+ pass
+
+ return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft}
def login(self, user, data, req):
req.load("http://freakshare.com/index.php?language=EN")
- page = req.load("http://freakshare.com/login.html", None,
+ html = req.load("http://freakshare.com/login.html", None,
{"submit": "Login", "user": user, "pass": data['password']}, cookies=True)
- if ">Wrong Username or Password" in page:
+ if ">Wrong Username or Password" in html:
self.wrongPassword()