diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/UlozTo.py | 13 | ||||
-rw-r--r-- | module/plugins/hoster/UlozTo.py | 19 |
2 files changed, 17 insertions, 15 deletions
diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 53cf54e7d..3c9b24f3a 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class UlozTo(Account): __name__ = "UlozTo" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __description__ = """Uloz.to account plugin""" __license__ = "GPLv3" @@ -18,7 +18,7 @@ class UlozTo(Account): ("pulpe", None)] - TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="/kredit" title="[^"]*?GB = ([\d.]+) MB"' + TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title="[^"]*?GB = ([\d.]+) MB"' def loadAccountInfo(self, user, req): @@ -29,16 +29,17 @@ class UlozTo(Account): req.cj.setCookie("ulozto.net", "ULOSESSID", self.phpsessid) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + trafficleft = float(m.group(1).replace(' ', '').replace(',', '.')) * 1000 * 1.048 if m else 0 - self.premium = True if trafficleft else False + premium = True if trafficleft else False - return {"validuntil": -1, "trafficleft": trafficleft} + return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': premium} def login(self, user, data, req): login_page = req.load('http://www.ulozto.net/?do=web-login', decode=True) - action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') - token = re.search('_token_" value="(.+?)"', login_page).group(1) + action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') + token = re.search('_token_" value="(.+?)"', login_page).group(1) html = req.load(urljoin("http://www.ulozto.net/", action), post={'_token_' : token, diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 8fa58d48b..0574734c5 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -17,27 +17,28 @@ class UlozTo(SimpleHoster): __type__ = "hoster" __version__ = "1.01" - __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<id>\w+/[^/?]*)' + __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' __description__ = """Uloz.to hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>' - NAME_PATTERN = r'<title>(?P<N>[^<]+) \| Uloz\.to</title>' - SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>' + INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>' + NAME_PATTERN = r'<title>(?P<N>[^<]+) \| Uloz\.to</title>' + SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>' OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>' + URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "www.ulozto.net")] SIZE_REPLACEMENTS = [('([\d.]+)\s([kMG])B', convertDecimalPrefix)] - URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "www.ulozto.net")] - ADULT_PATTERN = r'<form action="(?P<link>[^\"]*)" method="post" id="frm-askAgeForm">' - PASSWD_PATTERN = r'<div class="passwordProtectedFile">' + ADULT_PATTERN = r'<form action="(?P<link>[^\"]*)" method="post" id="frm-askAgeForm">' + PASSWD_PATTERN = r'<div class="passwordProtectedFile">' VIPLINK_PATTERN = r'<a href="[^"]*\?disclaimer=1" class="linkVip">' - FREE_URL_PATTERN = r'<div class="freeDownloadForm"><form action="([^"]+)"' + TOKEN_PATTERN = r'<input type="hidden" name="_token_" .*?value="(?P<token>.+?)"' + + FREE_URL_PATTERN = r'<div class="freeDownloadForm"><form action="([^"]+)"' PREMIUM_URL_PATTERN = r'<div class="downloadForm"><form action="([^"]+)"' - TOKEN_PATTERN = r'<input type="hidden" name="_token_" id="[^\"]*" value="(?P<token>.+?)"' def setup(self): |