From 3dbde9107d6886cdd4cabfdb752cdaec3935d4c3 Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 14 May 2013 14:08:14 +0200 Subject: FastshareCz: code cleanup --- module/plugins/accounts/FastshareCz.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py index d7886f437..69bbb0827 100644 --- a/module/plugins/accounts/FastshareCz.py +++ b/module/plugins/accounts/FastshareCz.py @@ -21,33 +21,34 @@ import re from module.plugins.Account import Account from module.utils import parseFileSize + class FastshareCz(Account): __name__ = "FastshareCz" __version__ = "0.02" __type__ = "account" __description__ = """fastshare.cz account plugin""" - __author_name__ = ("zoidberg" , "stickell") + __author_name__ = ("zoidberg", "stickell") __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") - + def loadAccountInfo(self, user, req): - html = req.load("http://www.fastshare.cz/user", decode = True) - + html = req.load("http://www.fastshare.cz/user", decode=True) + found = re.search(r'(?:Kredit|Credit)\s*: (.+?) ', html) if found: - trafficleft = parseFileSize(found.group(1)) / 1024 + trafficleft = parseFileSize(found.group(1)) / 1024 premium = True if trafficleft else False else: trafficleft = None - premium = False + premium = False return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} - + def login(self, user, data, req): 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 = { + html = req.load('http://www.fastshare.cz/sql.php', post={ "heslo": data['password'], "login": user - }, decode = True) - + }, decode=True) + if u'>Špatné uživatelské jméno nebo heslo.<' in html: self.wrongPassword() \ No newline at end of file -- cgit v1.2.3