diff options
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r-- | module/plugins/accounts/UlozTo.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 2632d2535..ea2562280 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -2,13 +2,15 @@ import re +from urlparse import urljoin + from module.plugins.Account import Account class UlozTo(Account): __name__ = "UlozTo" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __description__ = """Uloz.to account plugin""" __license__ = "GPLv3" @@ -20,9 +22,10 @@ class UlozTo(Account): def loadAccountInfo(self, user, req): - #this cookie gets lost somehow after each request - self.phpsessid = req.cj.getCookie("ULOSESSID") + self.phpsessid = req.cj.getCookie("ULOSESSID") #@NOTE: this cookie gets lost somehow after each request + html = req.load("http://www.ulozto.net/", decode=True) + req.cj.setCookie(".ulozto.net", "ULOSESSID", self.phpsessid) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) @@ -37,12 +40,13 @@ class UlozTo(Account): action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') token = re.search('_token_" value="(.+?)"', login_page).group(1) - html = req.load('http://www.ulozto.net'+action, post={ - "_token_": token, - "login": "Submit", - "password": data['password'], - "username": user - }, decode=True) + html = req.load(urljoin("http://www.ulozto.net/", action), + post={'_token_' : token, + 'do' : "loginForm-submit", + 'login' : u"Přihlásit", + 'password': data['password'], + 'username': user}, + decode=True) if '<div class="flash error">' in html: self.wrongPassword() |