diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-01-18 11:59:32 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-01-18 11:59:32 +0100 |
commit | 70cc18ec1552c580b8e53737a32f7324720d67dc (patch) | |
tree | 5cfc29ed77f5b5875e83bbd82ca53c8337f47441 /module/plugins | |
parent | Merge pull request #1044 from zapp-brannigan/patch-3 (diff) | |
download | pyload-70cc18ec1552c580b8e53737a32f7324720d67dc.tar.xz |
[CatShareNet] Update
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/CatShareNet.py | 34 | ||||
-rw-r--r-- | module/plugins/hoster/CatShareNet.py | 21 |
2 files changed, 23 insertions, 32 deletions
diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index 2552521e4..00bfadd09 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -10,40 +10,44 @@ from module.plugins.Account import Account class CatShareNet(Account): __name__ = "CatShareNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """CatShareNet account plugin""" __license__ = "GPLv3" __authors__ = [("prOq", None)] - PREMIUM_PATTERN = r'class="nav-collapse collapse pull-right">[\s\w<>=-."/:]*\sz.</a></li>\s*<li><a href="/premium">.*\s*<span style="color: red">(.*?)</span>[\s\w<>/]*href="/logout"' - VALID_UNTIL_PATTERN = r'<div class="span6 pull-right">[\s\w<>=-":;]*<span style="font-size:13px;">.*?<strong>(.*?)</strong></span>' - TRAFFIC_PATTERN = r'<a href="/premium">([0-9.]+ [kMG]B)' + PREMIUM_PATTERN = r'class="nav-collapse collapse pull-right">[\s\w<>=-."/:]*\sz.</a></li>\s*<li><a href="/premium">.*\s*<span style="color: red">(.*?)</span>[\s\w<>/]*href="/logout"' + VALID_UNTIL_PATTERN = r'<div class="span6 pull-right">[\s\w<>=-":;]*<span style="font-size:13px;">.*?<strong>(.*?)</strong></span>' + TRAFFIC_LEFT_PATTERN = r'<a href="/premium">([0-9.]+ [kMG]B)' def loadAccountInfo(self, user, req): - premium = False - validuntil = -1 + premium = False + validuntil = -1 trafficleft = -1 html = req.load("http://catshare.net/", decode=True) try: - m = re.search(self.PREMIUM_PATTERN, html) - if "Premium" in m.group(1): + if "Premium" in re.search(self.PREMIUM_PATTERN, html).group(1): premium = True + + except Exception: + pass + + try: + expiredate = re.search(self.VALID_UNTIL_PATTERN, html).group(1) + self.logDebug("Expire date: " + expiredate) + + validuntil = mktime(strptime(expiredate, "%d.%m.%Y")) + except Exception: pass try: - m = re.search(self.VALID_UNTIL_PATTERN, html) - expiredate = m.group(1) - if "-" not in expiredate: - validuntil = mktime(strptime(expiredate, "%d.%m.%Y")) - m = re.search(TRAFFIC_PATTERN, html) - if m: - trafficleft = int(self.parseTraffic(m.group(1))) + trafficleft = self.parseTraffic(re.search(TRAFFIC_LEFT_PATTERN, html).group(1)) + except Exception: pass diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 19598a092..ba8996193 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' @@ -26,9 +26,9 @@ class CatShareNet(SimpleHoster): OFFLINE_PATTERN = ur'Podany plik został usunięty\s*</div>' IP_BLOCKED_PATTERN = ur'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<' - SECONDS_PATTERN = 'var\scount\s=\s(\d+);' - LINK_FREE_PATTERN = r'<form action="(.+?)" method="GET">' - LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">' + WAIT_PATTERN = r'var\scount\s=\s(\d+);' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">' def setup(self): @@ -42,21 +42,8 @@ class CatShareNet(SimpleHoster): self.fail(_("Only connections from Polish IP address are allowed")) return super(CatShareNet, self).getFileInfo() - def handlePremium(self): - m = re.search(self.LINK_PREMIUM_PATTERN, self.html) - if m is None: - self.fail(_("File not found")) - - dl_link = m.group(1) - self.download(dl_link, disposition=True) - def handleFree(self, pyfile): - m = re.search(self.SECONDS_PATTERN, self.html) - if m: - wait_time = int(m.group(1)) - self.wait(wait_time, True) - recaptcha = ReCaptcha(self) challenge, response = recaptcha.challenge() |