diff options
author | prOq <anonim> | 2014-09-27 03:56:24 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-09-27 03:56:24 +0200 |
commit | 98b6f2781ecff3ad2a0eefbea0c98cb832e76fda (patch) | |
tree | 636d9a939b7e23ebc8eefa55c41a695e67b15611 /module | |
parent | [UnRar] Fix import error (diff) | |
download | pyload-98b6f2781ecff3ad2a0eefbea0c98cb832e76fda.tar.xz |
[CatShareNet] Plugin rewritten
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hoster/CatShareNet.py | 49 | ||||
-rw-r--r-- | module/plugins/hoster/TurbobitNet.py | 2 |
2 files changed, 32 insertions, 19 deletions
diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 4bbdfce89..2bcd261b7 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -2,43 +2,56 @@ import re -from module.plugins.internal.CaptchaService import ReCaptcha +from urllib import unquote + from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.CaptchaService import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" - __pattern__ = r'http://(?:www\.)?catshare.net/\w{16}.*' + __pattern__ = r'http://(?:www\.)?catshare\.net/\w+' __description__ = """CatShare.net hoster plugin""" - __author_name__ = "z00nx" - __author_mail__ = "z00nx0@gmail.com" + __author_name__ = ("z00nx", "prOq") + __author_mail__ = ("z00nx0@gmail.com", None) - FILE_INFO_PATTERN = r'<h3 class="pull-left"[^>]+>(?P<N>.*)</h3>\s+<h3 class="pull-right"[^>]+>(?P<S>.*)</h3>' - OFFLINE_PATTERN = r'Podany plik zosta' - SECONDS_PATTERN = r'var\s+count\s+=\s+(\d+);' + 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' + SECONDS_PATTERN = 'var\s+count\s+=\s+(\d+);' RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy" + LINK_PATTERN = r'<form action="(.+?)" method="GET">' def handleFree(self): m = re.search(self.SECONDS_PATTERN, self.html) - seconds = int(m.group(1)) - self.logDebug("Seconds found", seconds) - self.wait(seconds + 1) - recaptcha = ReCaptcha(self) + if m is not None: + seconds = int(m.group(1)) + self.logDebug("Seconds found", seconds) + self.wait(seconds + 1) + + # solve captcha and send solution challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY) - post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": code} - self.download(self.pyfile.url, post=post_data) - check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")}) - if check == "html": - self.logDebug("Wrong captcha entered") + self.html = self.load(self.pyfile.url, + post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field': code}, + decode=True, + cookies=True, + ref=True) + + # find download url + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.invalidCaptcha() - self.retry() + self.retry(reason="Wrong captcha entered") + + download_url = unquote(m.group(1)) + self.logDebug("Download url: " + download_url) + self.download(download_url) getInfo = create_getInfo(CatShareNet) diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index fbb163591..13c730b05 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -23,7 +23,7 @@ class TurbobitNet(SimpleHoster): __description__ = """ Turbobit.net hoster plugin """ __author_name__ = ("zoidberg", "prOq") - __author_mail__ = ("zoidberg@mujmail.cz", "") + __author_mail__ = ("zoidberg@mujmail.cz", None) FILE_NAME_PATTERN = r'id="file-title">(?P<N>.+?)<' |