summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/hoster/UpstoreNet.py36
1 files changed, 26 insertions, 10 deletions
diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py
index c863dff9d..90b921c0a 100644
--- a/module/plugins/hoster/UpstoreNet.py
+++ b/module/plugins/hoster/UpstoreNet.py
@@ -9,16 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UpstoreNet(SimpleHoster):
__name__ = "UpstoreNet"
__type__ = "hoster"
- __version__ = "0.09"
+ __version__ = "0.10"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?upstore\.net/'
- __config__ = [("activated" , "bool", "Activated" , True),
- ("use_premium" , "bool", "Use premium account if available" , True),
- ("fallback" , "bool", "Fallback to free download if premium fails" , True),
- ("chk_filesize", "bool", "Check file size" , True),
- ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )]
-
__description__ = """Upstore.Net File Download Hoster"""
__license__ = "GPLv3"
__authors__ = [("igel", "igelkun@myopera.com")]
@@ -27,9 +21,12 @@ class UpstoreNet(SimpleHoster):
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>'
+ LONG_WAIT_PATTERN = r'You should wait (\d+) min. before downloading next'
WAIT_PATTERN = r'var sec = (\d+)'
CHASH_PATTERN = r'<input type="hidden" name="hash" value="(.+?)">'
LINK_FREE_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>'
+ WRONG_CAPTCHA_PATTERN = r'Wrong captcha'
+ PREMIUM_ONLY_PATTERN = r'available only for Premium'
def handle_free(self, pyfile):
@@ -42,6 +39,7 @@ class UpstoreNet(SimpleHoster):
#: Continue to stage2
post_data = {'hash': chash, 'free': 'Slow download'}
self.data = self.load(pyfile.url, post=post_data)
+ self.check_errors()
#: STAGE 2: solv captcha and wait
#: First get the infos we need: recaptcha key and wait time
@@ -64,13 +62,31 @@ class UpstoreNet(SimpleHoster):
self.data = self.load(pyfile.url, post=post_data)
- #: STAGE 3: get direct link
+ # check whether the captcha was wrong
+ m = re.search(self.WRONG_CAPTCHA_PATTERN, self.data, re.S)
+ if m is not None:
+ continue
+
+
+ # STAGE 3: get direct link or wait time
+ m = re.search(self.LONG_WAIT_PATTERN, self.data, re.S)
+ if m is not None:
+ wait_time = 60* int(m.group(1))
+ self.wantReconnect = True
+ self.retry(wait_time=wait_time, reason=_("Please wait to download this file"))
+
m = re.search(self.LINK_FREE_PATTERN, self.data, re.S)
if m is not None:
+ self.link = m.group(1)
break
- if m is not None:
- self.link = m.group(1)
+ # sometimes, upstore just restarts the countdown without saying anything...
+ # in this case we'll just wait 1h and retry
+ self.wantReconnect = True
+ self.retry(wait_time=3600, reason=_("Upstore doesn't like us today"))
+
+
getInfo = create_getInfo(UpstoreNet)
+