diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-06-09 18:10:22 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-06-09 18:10:23 +0200 |
commit | 16af85004c84d0d6c626b4f8424ce9647669a0c1 (patch) | |
tree | 025d479862d376dbc17e934f4ed20031c8cd97d1 /pyload/plugins/accounts/UlozTo.py | |
parent | adapted to jshint config (diff) | |
download | pyload-16af85004c84d0d6c626b4f8424ce9647669a0c1.tar.xz |
moved everything from module to pyload
Diffstat (limited to 'pyload/plugins/accounts/UlozTo.py')
-rw-r--r-- | pyload/plugins/accounts/UlozTo.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/pyload/plugins/accounts/UlozTo.py b/pyload/plugins/accounts/UlozTo.py new file mode 100644 index 000000000..6652c8b7c --- /dev/null +++ b/pyload/plugins/accounts/UlozTo.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account +import re + +class UlozTo(Account): + __name__ = "UlozTo" + __version__ = "0.04" + __type__ = "account" + __description__ = """uloz.to account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="http://www.ulozto.net/kredit" title="[^"]*?GB = ([0-9.]+) MB"' + + def loadAccountInfo(self, user, req): + #this cookie gets lost somehow after each request + self.phpsessid = req.cj.getCookie("ULOSESSID") + html = req.load("http://www.ulozto.net/", decode = True) + req.cj.setCookie("www.ulozto.net", "ULOSESSID", self.phpsessid) + + found = re.search(self.TRAFFIC_LEFT_PATTERN, html) + trafficleft = int(float(found.group(1).replace(' ','').replace(',','.')) * 1000 / 1.024) if found else 0 + self.premium = True if trafficleft else False + + return {"validuntil": -1, "trafficleft": trafficleft} + + def login(self, user, data, req): + html = req.load('http://www.ulozto.net/login?do=loginForm-submit', post = { + "login": "Submit", + "password": data['password'], + "username": user + }, decode = True) + + if '<ul class="error">' in html: + self.wrongPassword() |