summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/hoster/UpstoreNet.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-09-08 00:29:57 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-09-14 11:02:23 +0200
commit68d662e689cd42687341c550fb6ebb74e6968d21 (patch)
tree486cef41bd928b8db704894233b2cef94a6e346f /pyload/plugins/hoster/UpstoreNet.py
parentsave_join -> safe_join & save_path -> safe_filename (diff)
downloadpyload-68d662e689cd42687341c550fb6ebb74e6968d21.tar.xz
module -> pyload
Diffstat (limited to 'pyload/plugins/hoster/UpstoreNet.py')
-rw-r--r--pyload/plugins/hoster/UpstoreNet.py75
1 files changed, 75 insertions, 0 deletions
diff --git a/pyload/plugins/hoster/UpstoreNet.py b/pyload/plugins/hoster/UpstoreNet.py
new file mode 100644
index 000000000..bd084612c
--- /dev/null
+++ b/pyload/plugins/hoster/UpstoreNet.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from pyload.plugins.internal.CaptchaService import ReCaptcha
+from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class UpstoreNet(SimpleHoster):
+ __name__ = "UpstoreNet"
+ __type__ = "hoster"
+ __version__ = "0.02"
+
+ __pattern__ = r'https?://(?:www\.)?upstore\.net/'
+
+ __description__ = """Upstore.Net File Download Hoster"""
+ __author_name__ = "igel"
+ __author_mail__ = "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+)'
+ OFFLINE_PATTERN = r'<span class="error">File not found</span>'
+
+ WAIT_PATTERN = r'var sec = (\d+)'
+ CHASH_PATTERN = r'<input type="hidden" name="hash" value="([^"]*)">'
+ LINK_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>'
+
+
+ def handleFree(self):
+ # STAGE 1: get link to continue
+ m = re.search(self.CHASH_PATTERN, self.html)
+ if m is None:
+ self.parseError("could not detect hash")
+ chash = m.group(1)
+ 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)
+
+ # 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)
+
+ # 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
+
+ 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)
+ if m:
+ break
+
+ if m is None:
+ self.parseError("could not detect direct link")
+
+ direct = m.group(1)
+ self.logDebug('found direct link: ' + direct)
+ self.download(direct, disposition=True)
+
+
+getInfo = create_getInfo(UpstoreNet)