diff options
Diffstat (limited to 'pyload/plugins/account/FastshareCz.py')
-rw-r--r-- | pyload/plugins/account/FastshareCz.py | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/pyload/plugins/account/FastshareCz.py b/pyload/plugins/account/FastshareCz.py index d4ef08c2b..1a7dff4b1 100644 --- a/pyload/plugins/account/FastshareCz.py +++ b/pyload/plugins/account/FastshareCz.py @@ -1,42 +1,53 @@ # -*- coding: utf-8 -*- import re + from pyload.plugins.base.Account import Account -from pyload.utils import parseFileSize +from module.utils import parseFileSize class FastshareCz(Account): - __name__ = "FastshareCz" - __type__ = "account" - __version__ = "0.03" + __name__ = "FastshareCz" + __type__ = "account" + __version__ = "0.05" __description__ = """Fastshare.cz account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] - CREDIT_PATTERN = r'(?:Kredit|Credit)\s*</td>\s*<td[^>]*>([\d. \w]+) ' + CREDIT_PATTERN = r'My account\s*\((.+?)\)' def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = None + premium = None + html = req.load("http://www.fastshare.cz/user", decode=True) m = re.search(self.CREDIT_PATTERN, html) if m: - trafficleft = parseFileSize(m.group(1)) / 1024 - premium = True if trafficleft else False + trafficleft = self.parseTraffic(m.group(1)) + + if trafficleft: + premium = True + validuntil = -1 else: - trafficleft = None premium = False - return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): + req.cj.setCookie(".fastshare.cz", "lang", "en") + req.load('http://www.fastshare.cz/login') # Do not remove or it will not login - html = req.load('http://www.fastshare.cz/sql.php', post={ - "heslo": data['password'], - "login": user - }, decode=True) - if u'>Špatné uživatelské jméno nebo heslo.<' in html: + html = req.load("http://www.fastshare.cz/sql.php", + post={'login': user, 'heslo': data['password']}, + decode=True) + + if ">Wrong username or password" in html: self.wrongPassword() |