diff options
Diffstat (limited to 'module/plugins/hoster/UpstoreNet.py')
-rw-r--r-- | module/plugins/hoster/UpstoreNet.py | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index 99aa25b48..25c424f1f 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -1,20 +1,24 @@ # -*- coding: utf-8 -*- + import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UpstoreNet(SimpleHoster): - __name__ = "UpstoreNet" - __type__ = "hoster" + __name__ = "UpstoreNet" + __type__ = "hoster" + __version__ = "0.03" + __pattern__ = r'https?://(?:www\.)?upstore\.net/' - __version__ = "0.02" + __description__ = """Upstore.Net File Download Hoster""" - __author_name__ = "igel" - __author_mail__ = "igelkun@myopera.com" + __license__ = "GPLv3" + __authors__ = [("igel", "igelkun@myopera.com")] + - FILE_INFO_PATTERN = r'<div class="comment">.*?</div>\s*\n<h2 style="margin:0">(?P<N>.*?)</h2>\s*\n<div class="comment">\s*\n\s*(?P<S>[\d.]+) (?P<U>\w+)' + INFO_PATTERN = r'<div class="comment">.*?</div>\s*\n<h2 style="margin:0">(?P<N>.*?)</h2>\s*\n<div class="comment">\s*\n\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'<span class="error">File not found</span>' WAIT_PATTERN = r'var sec = (\d+)' @@ -26,9 +30,9 @@ class UpstoreNet(SimpleHoster): # STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: - self.parseError("could not detect hash") + self.error(_("CHASH_PATTERN not found")) chash = m.group(1) - self.logDebug("read hash " + chash) + self.logDebug("Read hash " + chash) # continue to stage2 post_data = {'hash': chash, 'free': 'Slow download'} self.html = self.load(self.pyfile.url, post=post_data, decode=True) @@ -36,36 +40,33 @@ class UpstoreNet(SimpleHoster): # 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): m = re.search(self.WAIT_PATTERN, self.html) if m is None: - self.parseError("could not find wait pattern") - wait_time = m.group(1) + self.error(_("Wait pattern not found")) + wait_time = int(m.group(1)) # then, do the waiting self.wait(wait_time) # then, handle the captcha - challenge, code = recaptcha.challenge() - post_data['recaptcha_challenge_field'] = challenge - post_data['recaptcha_response_field'] = code + challenge, response = recaptcha.challenge() + post_data.update({'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) self.html = self.load(self.pyfile.url, post=post_data, decode=True) # STAGE 3: get direct link - m = re.search(self.LINK_PATTERN, self.html, re.DOTALL) + m = re.search(self.LINK_PATTERN, self.html, re.S) if m: break if m is None: - self.parseError("could not detect direct link") + self.error(_("Download link not found")) direct = m.group(1) - self.logDebug('found direct link: ' + direct) self.download(direct, disposition=True) |