summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/FastshareCz.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-10 21:30:23 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-10 21:30:23 +0100
commit1bf311d182ac02d46de2ac082ff5c120670ec9bb (patch)
tree75546e03c86905f051b42ad9bcb39c92bd15bb68 /module/plugins/accounts/FastshareCz.py
parent[StorageTo] Fix hoster __version__ (diff)
downloadpyload-1bf311d182ac02d46de2ac082ff5c120670ec9bb.tar.xz
[FastshareCz] Fix account
Diffstat (limited to 'module/plugins/accounts/FastshareCz.py')
-rw-r--r--module/plugins/accounts/FastshareCz.py28
1 files changed, 18 insertions, 10 deletions
diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py
index 247838c23..ff437c101 100644
--- a/module/plugins/accounts/FastshareCz.py
+++ b/module/plugins/accounts/FastshareCz.py
@@ -7,7 +7,7 @@ from module.plugins.Account import Account
class FastshareCz(Account):
__name__ = "FastshareCz"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.05"
__description__ = """Fastshare.cz account plugin"""
__license__ = "GPLv3"
@@ -15,29 +15,37 @@ class FastshareCz(Account):
("stickell", "l.stickell@yahoo.it")]
- CREDIT_PATTERN = r'(?:Kredit|Credit)\s*</td>\s*<td[^>]*>([\w.]+)&nbsp;'
+ 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 = self.parseTraffic(m.group(1))
- premium = True if trafficleft else False
+
+ 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()