diff options
author | Nitzo <nitzo2001@yahoo.com> | 2016-08-24 22:39:07 +0200 |
---|---|---|
committer | Nitzo <nitzo2001@yahoo.com> | 2016-08-24 22:39:07 +0200 |
commit | 6164a093d427a7cdb8f4bb56e1c08bfe94b08423 (patch) | |
tree | 771b8358b79e8accb9ab2a34da2a59d957690425 /module | |
parent | [Keep2ShareCc] Revert https://github.com/pyload/pyload/commit/4f7df2759546141... (diff) | |
download | pyload-6164a093d427a7cdb8f4bb56e1c08bfe94b08423.tar.xz |
[CatShareNet] fix #2576
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/CatShareNet.py | 31 | ||||
-rw-r--r-- | module/plugins/hoster/CatShareNet.py | 21 |
2 files changed, 30 insertions, 22 deletions
diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index 8831b9014..b80cf59b9 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -9,17 +9,18 @@ from module.plugins.internal.Account import Account class CatShareNet(Account): __name__ = "CatShareNet" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __description__ = """Catshare.net account plugin""" __license__ = "GPLv3" - __authors__ = [("prOq", None)] + __authors__ = [("prOq", None ), + ("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] PREMIUM_PATTERN = r'<a href="/premium">Konto:[\s\n]*Premium' VALID_UNTIL_PATTERN = r'>Konto premium.*?<strong>(.*?)</strong></span>' - TRAFFIC_LEFT_PATTERN = r'<a href="/premium">([0-9.]+ [kMG]B)' + TRAFFIC_LEFT_PATTERN = r'<a href="/premium">(?P<S>[\d.,]+) (?P<U>[kMG]B)' def grab_info(self, user, password, data): @@ -32,25 +33,23 @@ class CatShareNet(Account): if re.search(self.PREMIUM_PATTERN, html): premium = True - try: - expiredate = re.search(self.VALID_UNTIL_PATTERN, html).group(1) - self.log_debug("Expire date: " + expiredate) + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + validuntil = time.mktime(time.strptime(m.group(1), "%Y-%m-%d %H:%M:%S")) - validuntil = time.mktime(time.strptime(expiredate, "%Y-%m-%d %H:%M:%S")) - - except Exception: - pass - - try: - trafficleft = self.parse_traffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) - - except Exception: - pass + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + trafficleft = self.parse_traffic(m.group(1), m.group(2)) return {'premium': premium, 'trafficleft': trafficleft, 'validuntil': validuntil} def signin(self, user, password, data): + html = self.load("http://catshare.net/") + + if '<a href="/logout">Wyloguj</a>' in html: + self.skip_login() + html = self.load("http://catshare.net/login", #@TODO: Revert to `https` in 0.4.10 post={'user_email' : user, 'user_password' : password, diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 0efe0717c..606878caa 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -9,7 +9,7 @@ from module.plugins.captcha.ReCaptcha import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{15,16}' @@ -21,12 +21,15 @@ class CatShareNet(SimpleHoster): __description__ = """CatShare.net hoster plugin""" __license__ = "GPLv3" - __authors__ = [("z00nx", "z00nx0@gmail.com"), - ("prOq", None), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("z00nx", "z00nx0@gmail.com" ), + ("prOq", None ), + ("Walter Purcaro", "vuolter@gmail.com" ), + ("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] - INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<' + NAME_PATTERN = r'(?:<div class="col-sm-8 col-xs-12 text-left">\s*<h3>|<title>)(?P<N>.+)(?:</h3>| \()' + SIZE_PATTERN = r'(?:<div class="col-sm-4 col-xs-12 text-right">\s*<h3>|<title>.+?\()(?P<S>[\d.,]+) (?P<U>[\w^_]+)(?:</h3>|\))' + OFFLINE_PATTERN = r'<div class="alert alert-error"' IP_BLOCKED_PATTERN = ur'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<' @@ -37,7 +40,7 @@ class CatShareNet(SimpleHoster): def setup(self): - self.multiDL = self.premium + self.multiDL = self.premium self.resume_download = True @@ -52,3 +55,9 @@ class CatShareNet(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.data) if m is not None: self.link = m.group(1) + + + def handle_premium(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.data) + if m is not None: + self.link = m.group(1) |