summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/ShareonlineBiz.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/ShareonlineBiz.py')
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py65
1 files changed, 29 insertions, 36 deletions
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index b5af3ea35..2223068e5 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -3,7 +3,6 @@
import re
import time
import urllib
-import urlparse
from module.network.RequestFactory import getURL as get_url
from module.plugins.captcha.ReCaptcha import ReCaptcha
@@ -13,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class ShareonlineBiz(SimpleHoster):
__name__ = "ShareonlineBiz"
__type__ = "hoster"
- __version__ = "0.55"
+ __version__ = "0.58"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)'
@@ -68,25 +67,20 @@ class ShareonlineBiz(SimpleHoster):
def handle_captcha(self):
recaptcha = ReCaptcha(self)
-
- for _i in xrange(5):
- response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY)
-
- m = re.search(r'var wait=(\d+);', self.html)
- self.set_wait(int(m.group(1)) if m else 30)
-
- res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)),
- post={'dl_free' : "1",
- 'recaptcha_challenge_field': challenge,
- 'recaptcha_response_field' : response})
- if not res == "0":
- self.captcha.correct()
- return res
- else:
- self.captcha.invalid()
+ response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY)
+
+ m = re.search(r'var wait=(\d+);', self.html)
+ self.set_wait(int(m.group(1)) if m else 30)
+
+ res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)),
+ post={'dl_free' : "1",
+ 'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field' : response})
+ if res != "0":
+ self.captcha.correct()
+ return res
else:
- self.captcha.invalid()
- self.fail(_("No valid captcha solution received"))
+ self.retry_captcha()
def handle_free(self, pyfile):
@@ -101,30 +95,28 @@ class ShareonlineBiz(SimpleHoster):
self.link = res.decode('base64')
if not self.link.startswith("http://"):
- self.error(_("Wrong download url"))
+ self.error(_("Invalid url"))
self.wait()
- def check_file(self):
- check = self.check_download({'cookie': re.compile(r'<div id="dl_failure"'),
+ def check_download(self):
+ check = self.check_file({'cookie': re.compile(r'<div id="dl_failure"'),
'fail' : re.compile(r"<title>Share-Online")})
if check == "cookie":
- self.captcha.invalid()
- self.retry(5, 60, _("Cookie failure"))
+ self.retry_captcha(5, 60, _("Cookie failure"))
elif check == "fail":
- self.captcha.invalid()
- self.retry(5, 5 * 60, _("Download failed"))
+ self.retry_captcha(5, 5 * 60, _("Download failed"))
- return super(ShareonlineBiz, self).check_file()
+ return super(ShareonlineBiz, self).check_download()
def handle_premium(self, pyfile): #: Should be working better loading (account) api internally
html = self.load("https://api.share-online.biz/account.php",
- get={'username': self.user,
- 'password': self.account.get_info(self.user)['login']['password'],
+ get={'username': self.account.user,
+ 'password': self.account.get_login('password'),
'act' : "download",
'lid' : self.info['fileid']})
@@ -136,7 +128,7 @@ class ShareonlineBiz(SimpleHoster):
self.log_debug(dlinfo)
- if not dlinfo['status'] == "online":
+ if dlinfo['status'] != "online":
self.offline()
else:
pyfile.name = dlinfo['name']
@@ -160,6 +152,7 @@ class ShareonlineBiz(SimpleHoster):
try:
self.log_error(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1))
+
except Exception:
self.log_error(_("Unknown error occurred"), errmsg)
@@ -170,18 +163,18 @@ class ShareonlineBiz(SimpleHoster):
self.fail(_("Premium account needed"))
elif errmsg in ("expired", "server"):
- self.retry(wait_time=600, reason=errmsg)
+ self.retry(wait=600, msg=errmsg)
elif errmsg == "full":
self.retry(10, 600, _("Server is full"))
elif 'slot' in errmsg:
- self.wantReconnect = True
- self.retry(24, 3600, errmsg)
+ self.wait(3600, reconnect=True)
+ self.restart(errmsg, premium=True)
else:
- self.wantReconnect = True
- self.retry(wait_time=60, reason=errmsg)
+ self.wait(60, reconnect=True)
+ self.restart(errmsg, premium=True)
getInfo = create_getInfo(ShareonlineBiz)