summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/ShareLinksBiz.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-01 04:55:17 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-01 04:55:17 +0200
commit25d5726d4953b93a2e286fd6af8d4ead20670ba6 (patch)
tree9d38f6942af2fadc094a75dd43699051f356b4d7 /module/plugins/crypter/ShareLinksBiz.py
parent[AntiVirus] Folder support (diff)
downloadpyload-25d5726d4953b93a2e286fd6af8d4ead20670ba6.tar.xz
A lot of plugin code cosmetics
Diffstat (limited to 'module/plugins/crypter/ShareLinksBiz.py')
-rw-r--r--module/plugins/crypter/ShareLinksBiz.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py
index 3316aea56..e372d7c6a 100644
--- a/module/plugins/crypter/ShareLinksBiz.py
+++ b/module/plugins/crypter/ShareLinksBiz.py
@@ -66,14 +66,18 @@ class ShareLinksBiz(Crypter):
def init_file(self, pyfile):
url = pyfile.url
+
if 's2l.biz' in url:
url = self.load(url, just_header=True)['location']
+
if re.match(self.__pattern__, url):
self.base_url = "http://www.%s.biz" % re.match(self.__pattern__, url).group(1)
self.file_id = re.match(self.__pattern__, url).group('ID')
+
else:
self.log_debug("Could not initialize, URL [%s] does not match pattern [%s]" % (url, self.__pattern__))
- self.fail("Unsupported download link")
+ self.fail(_("Unsupported download link"))
+
self.package = pyfile.package()
@@ -81,7 +85,8 @@ class ShareLinksBiz(Crypter):
if "No usable content was found" in self.html:
self.log_debug("File not found")
return False
- return True
+ else:
+ return True
def is_password_protected(self):
@@ -121,7 +126,8 @@ class ShareLinksBiz(Crypter):
m = re.search(r'<img src="/captcha.gif\?d=(.+?)&PHPSESSID=(.+?)&legend=1"', self.html)
if not m:
self.log_debug("Captcha url data not found, maybe plugin out of date?")
- self.fail("Captcha url data not found")
+ self.fail(_("Captcha url data not found"))
+
captchaUrl = self.base_url + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2))
self.log_debug("Waiting user for correct position")
coords = self.captcha.decrypt(captchaUrl, input_type="gif", output_type='positional')
@@ -130,8 +136,8 @@ class ShareLinksBiz(Crypter):
#: Resolve captcha
href = self._resolve_coords(coords, captchaMap)
if href is None:
- self.captcha.invalid()
- self.retry(delay=5)
+ self.retry_captcha(wait=5)
+
url = self.base_url + href
self.html = self.load(url)
@@ -155,13 +161,11 @@ class ShareLinksBiz(Crypter):
def handle_errors(self):
if "The inserted password was wrong" in self.html:
- self.log_debug("Incorrect password, please set right password on 'Edit package' form and retry")
- self.fail(_("Incorrect password, please set right password on 'Edit package' form and retry"))
+ self.fail(_("Wrong password"))
if self.captcha:
if "Your choice was wrong" in self.html:
- self.captcha.invalid()
- self.retry(delay=5)
+ self.retry_captcha(wait=5)
else:
self.captcha.correct()
@@ -172,7 +176,7 @@ class ShareLinksBiz(Crypter):
#: Extract from web package header
title_re = r'<h2><img.*?/>(.*)</h2>'
m = re.search(title_re, self.html, re.S)
- if m:
+ if m is not None:
title = m.group(1).strip()
if 'unnamed' not in title:
name = folder = title