diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-09-28 00:39:28 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-09-28 00:39:28 +0200 |
commit | 13d788058ce3ebada150ebbe7c1a9415f76253d7 (patch) | |
tree | f62e184ecd86cfa795c4e0262836be98616edc57 /module/plugins/hoster/CatShareNet.py | |
parent | [ZippyshareCom] Fix alternative checksum type (diff) | |
download | pyload-13d788058ce3ebada150ebbe7c1a9415f76253d7.tar.xz |
[CatShareNet] Fixup
Diffstat (limited to 'module/plugins/hoster/CatShareNet.py')
-rw-r--r-- | module/plugins/hoster/CatShareNet.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 88ca6c927..f250f4099 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -2,8 +2,6 @@ import re -from urllib import unquote - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.plugins.internal.CaptchaService import ReCaptcha @@ -11,48 +9,50 @@ from module.plugins.internal.CaptchaService import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' __description__ = """CatShare.net hoster plugin""" - __author_name__ = ("z00nx", "prOq") - __author_mail__ = ("z00nx0@gmail.com", None) + __author_name__ = ("z00nx", "prOq", "Walter Purcaro") + __author_mail__ = ("z00nx0@gmail.com", None, "vuolter@gmail.com") - FILE_INFO_PATTERN = r'<h3 class="pull-left"[^>]+>(?P<N>.+)</h3>\s+<h3 class="pull-right"[^>]+>(?P<S>.+)</h3>' - FILE_OFFLINE_PATTERN = r'Podany plik zosta' + FILE_INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.]+) (?P<U>\w+)\)<' + OFFLINE_PATTERN = r'Podany plik został usunięty\s*</div>' - SECONDS_PATTERN = 'var\s+count\s+=\s+(\d+);' + IP_BLOCKED_PATTERN = r'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<' + SECONDS_PATTERN = 'var count = (\d+);' RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy" LINK_PATTERN = r'<form action="(.+?)" method="GET">' + def process(self, pyfile): + m = re.search(self.IP_BLOCKED_PATTERN, self.html) + if m is None: + self.fail("Only connections from Polish IP address are allowed") + super(CatShareNet, self).process(pyfile) + + def handleFree(self): m = re.search(self.SECONDS_PATTERN, self.html) - if m is not None: - seconds = int(m.group(1)) - self.logDebug("Seconds found", seconds) - self.wait(seconds + 1) + if m: + wait_time = int(m.group(1)) + self.wait(wait_time, True) - # solve captcha and send solution recaptcha = ReCaptcha(self) challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY) self.html = self.load(self.pyfile.url, - post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field': code}, - decode=True, - cookies=True, - ref=True) + post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': code}) - # find download url m = re.search(self.LINK_PATTERN, self.html) if m is None: self.invalidCaptcha() self.retry(reason="Wrong captcha entered") - download_url = unquote(m.group(1)) - self.logDebug("Download url: " + download_url) - self.download(download_url) + dl_link = m.group(1) + self.download(dl_link) getInfo = create_getInfo(CatShareNet) |