diff options
author | Stefano <l.stickell@yahoo.it> | 2014-04-10 14:57:46 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2014-04-21 17:13:51 +0200 |
commit | 0c079cd625a835279f3b319e7c64e23fa39f3385 (patch) | |
tree | a71e6d7b92b25da16e70eeb78a949581feadc684 | |
parent | Improved ReCaptcha class: (diff) | |
download | pyload-0c079cd625a835279f3b319e7c64e23fa39f3385.tar.xz |
Upstore: using the improved ReCaptcha class
(cherry picked from commit 5c8ab19be496ad3cda7e3fed5a5dc678a9272cd6)
-rw-r--r-- | module/plugins/hoster/UpstoreNet.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index d2b3e0529..9d1c4b3dd 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -9,7 +9,7 @@ class UpstoreNet(SimpleHoster): __name__ = "UpstoreNet" __type__ = "hoster" __pattern__ = r"https?://(?:www\.)?upstore\.net/" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Upstore.Net File Download Hoster""" __author_name__ = ("igel") @@ -17,7 +17,6 @@ class UpstoreNet(SimpleHoster): FILE_OFFLINE_PATTERN = r'<span class="error">File not found</span>' WAIT_PATTERN = r"var sec = (\d+)" - RECAPTCHA_PATTERN = r"Recaptcha.create.*?'(.*?)'" CHASH_PATTERN = r'<input type="hidden" name="hash" value="([^"]*)">' DIRECT_LINK_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' @@ -32,30 +31,27 @@ class UpstoreNet(SimpleHoster): post_data = {'hash': chash, 'free': 'Slow download'} self.html = self.load(self.pyfile.url, post=post_data, decode=True) + # STAGE 2: solv captcha and wait + # first get the infos we need: recaptcha key and wait time + recaptcha = ReCaptcha(self) + if not recaptcha.detect_key(self.html): + self.parseError("could not find recaptcha pattern") + self.logDebug("using captcha key " + recaptcha.recaptcha_key) # try the captcha 5 times for i in xrange(5): - # STAGE 2: solv captcha and wait - # first get the infos we need: recaptcha key and wait time - m = re.search(self.RECAPTCHA_PATTERN, self.html) - if not m: - self.parseError("could not find recaptcha pattern") - recaptcha_key = m.group(1) - self.logDebug("using captcha key " + recaptcha_key) - recaptcha = ReCaptcha(self) - m = re.search(self.WAIT_PATTERN, self.html) if not m: self.parseError("could not find wait pattern") wait_time = m.group(1) + # then, do the waiting + self.wait(wait_time) + # then, handle the captcha - challenge, code = recaptcha.challenge(recaptcha_key) + challenge, code = recaptcha.challenge() post_data['recaptcha_challenge_field'] = challenge post_data['recaptcha_response_field'] = code - # then, do the waiting - self.wait(wait_time) - self.html = self.load(self.pyfile.url, post=post_data, decode=True) # STAGE 3: get direct link |