summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/CrockoCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/CrockoCom.py')
-rw-r--r--module/plugins/hoster/CrockoCom.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py
index e5f94800b..4f872f60a 100644
--- a/module/plugins/hoster/CrockoCom.py
+++ b/module/plugins/hoster/CrockoCom.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import re
+import urlparse
from module.plugins.internal.CaptchaService import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -9,36 +10,37 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class CrockoCom(SimpleHoster):
__name__ = "CrockoCom"
__type__ = "hoster"
- __version__ = "0.17"
+ __version__ = "0.19"
__pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """Crocko hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- NAME_PATTERN = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)'
- SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>'
+ NAME_PATTERN = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)'
+ SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>'
OFFLINE_PATTERN = r'<h1>Sorry,<br />the page you\'re looking for <br />isn\'t here.</h1>|File not found'
- CAPTCHA_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';")
+ CAPTCHA_PATTERN = r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';"
- FORM_PATTERN = r'<form method="post" action="([^"]+)">(.*?)</form>'
- FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>'
+ FORM_PATTERN = r'<form method="post" action="(.+?)">(.*?)</form>'
+ FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?.*?>'
- NAME_REPLACEMENTS = [(r'<[^>]*>', '')]
+ NAME_REPLACEMENTS = [(r'<.*?>', '')]
- def handleFree(self):
+ def handleFree(self, pyfile):
if "You need Premium membership to download this file." in self.html:
self.fail(_("You need Premium membership to download this file"))
for _i in xrange(5):
m = re.search(self.CAPTCHA_PATTERN, self.html)
if m:
- url, wait_time = 'http://crocko.com' + m.group(1), int(m.group(2))
- self.wait(wait_time)
+ url = urlparse.urljoin("http://crocko.com", m.group(1))
+ self.wait(m.group(2))
self.html = self.load(url)
else:
break
@@ -52,14 +54,10 @@ class CrockoCom(SimpleHoster):
recaptcha = ReCaptcha(self)
for _i in xrange(5):
- inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge()
+ inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge()
self.download(action, post=inputs)
- check = self.checkDownload({
- "captcha_err": recaptcha.KEY_AJAX_PATTERN
- })
-
- if check == "captcha_err":
+ if self.checkDownload({"captcha": recaptcha.KEY_AJAX_PATTERN}):
self.invalidCaptcha()
else:
break