summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/hoster/ShareonlineBiz.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins/hoster/ShareonlineBiz.py')
-rw-r--r--pyload/plugins/hoster/ShareonlineBiz.py86
1 files changed, 40 insertions, 46 deletions
diff --git a/pyload/plugins/hoster/ShareonlineBiz.py b/pyload/plugins/hoster/ShareonlineBiz.py
index d48d76018..73d598cb9 100644
--- a/pyload/plugins/hoster/ShareonlineBiz.py
+++ b/pyload/plugins/hoster/ShareonlineBiz.py
@@ -18,9 +18,9 @@ def getInfo(urls):
for chunk in chunks(urls, 90):
api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/", "").rstrip("/") for x in
chunk)} # api only supports old style links
- src = getURL(api_url_base, post=api_param_file, decode=True)
+ html = getURL(api_url_base, post=api_param_file, decode=True)
result = []
- for i, res in enumerate(src.split("\n")):
+ for i, res in enumerate(html.split("\n")):
if not res:
continue
fields = res.split(";")
@@ -37,73 +37,65 @@ def getInfo(urls):
class ShareonlineBiz(Hoster):
- __name__ = "ShareonlineBiz"
- __type__ = "hoster"
- __version__ = "0.40"
+ __name__ = "ShareonlineBiz"
+ __type__ = "hoster"
+ __version__ = "0.41"
- __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download.php\?id=|dl/)(?P<ID>\w+)'
+ __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)'
__description__ = """Shareonline.biz hoster plugin"""
- __authors__ = [("spoob", "spoob@pyload.org"),
- ("mkaay", "mkaay@mkaay.de"),
- ("zoidberg", "zoidberg@mujmail.cz"),
- ("Walter Purcaro", "vuolter@gmail.com")]
+ __license__ = "GPLv3"
+ __authors__ = [("spoob", "spoob@pyload.org"),
+ ("mkaay", "mkaay@mkaay.de"),
+ ("zoidberg", "zoidberg@mujmail.cz"),
+ ("Walter Purcaro", "vuolter@gmail.com")]
ERROR_INFO_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>'
def setup(self):
- # range request not working?
- # api supports resume, only one chunk
- # website isn't supporting resuming in first place
self.file_id = re.match(self.__pattern__, self.pyfile.url).group("ID")
self.pyfile.url = "http://www.share-online.biz/dl/" + self.file_id
self.resumeDownload = self.premium
self.multiDL = False
- #self.chunkLimit = 1
self.check_data = None
+
def process(self, pyfile):
if self.premium:
self.handlePremium()
- #web-download fallback removed - didn't work anyway
else:
self.handleFree()
- # check = self.checkDownload({"failure": re.compile(self.ERROR_INFO_PATTERN)})
- # if check == "failure":
- # try:
- # self.retry(reason=self.lastCheck.group(1).decode("utf8"))
- # except:
- # self.retry(reason="Unknown error")
-
if self.api_data:
self.check_data = {"size": int(self.api_data['size']), "md5": self.api_data['md5']}
+
def loadAPIData(self):
api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1"
- api_param_file = {"links": self.file_id} # api only supports old style links
- src = self.load(api_url_base, cookies=False, post=api_param_file, decode=True)
+ api_param_file = {"links": self.file_id} #: api only supports old style links
+ html = self.load(api_url_base, cookies=False, post=api_param_file, decode=True)
- fields = src.split(";")
+ fields = html.split(";")
self.api_data = {"fileid": fields[0],
"status": fields[1]}
if not self.api_data['status'] == "OK":
self.offline()
else:
self.api_data['filename'] = fields[2]
- self.api_data['size'] = fields[3] # in bytes
- self.api_data['md5'] = fields[4].strip().lower().replace("\n\n", "") # md5
+ self.api_data['size'] = fields[3] #: in bytes
+ self.api_data['md5'] = fields[4].strip().lower().replace("\n\n", "") #: md5
+
def handleFree(self):
self.loadAPIData()
self.pyfile.name = self.api_data['filename']
self.pyfile.size = int(self.api_data['size'])
- self.html = self.load(self.pyfile.url, cookies=True) # refer, stuff
+ self.html = self.load(self.pyfile.url, cookies=True) #: refer, stuff
self.setWait(3)
self.wait()
@@ -113,27 +105,26 @@ class ShareonlineBiz(Hoster):
m = re.search(r'var wait=(\d+);', self.html)
recaptcha = ReCaptcha(self)
- for _ in xrange(5):
+ for _i in xrange(5):
challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX")
self.setWait(int(m.group(1)) if m else 30)
- response = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), post={
- 'dl_free': '1',
- 'recaptcha_challenge_field': challenge,
- 'recaptcha_response_field': response})
+ res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)),
+ post={'dl_free': '1',
+ 'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field': response})
- if not response == '0':
+ if not res == '0':
self.correctCaptcha()
break
else:
self.invalidCaptcha()
else:
self.invalidCaptcha()
- self.fail("No valid captcha solution received")
+ self.fail(_("No valid captcha solution received"))
- download_url = response.decode("base64")
- self.logDebug(download_url)
+ download_url = res.decode("base64")
if not download_url.startswith("http://"):
- self.parseError("download url")
+ self.error(_("Wrong download url"))
self.wait()
self.download(download_url)
@@ -151,14 +142,15 @@ class ShareonlineBiz(Hoster):
else:
self.correctCaptcha()
+
def handlePremium(self): #: should be working better loading (account) api internally
self.account.getAccountInfo(self.user, True)
- src = self.load("http://api.share-online.biz/account.php",
+ html = self.load("http://api.share-online.biz/account.php",
{"username": self.user, "password": self.account.accounts[self.user]['password'],
"act": "download", "lid": self.file_id})
self.api_data = dlinfo = {}
- for line in src.splitlines():
+ for line in html.splitlines():
key, value = line.split(": ")
dlinfo[key.lower()] = value
@@ -176,20 +168,22 @@ class ShareonlineBiz(Hoster):
self.multiDL = True
self.download(dlLink)
+
def checkErrors(self):
m = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL)
if m is None:
return
err = m.group(1)
- m = re.search(self.ERROR_INFO_PATTERN, self.html)
- msg = m.group(1) if m else ""
- self.logError(err, msg or "Unknown error occurred")
+ try:
+ self.logError(err, re.search(self.ERROR_INFO_PATTERN, self.html).group(1))
+ except:
+ self.logError(err, "Unknown error occurred")
if err == "invalid":
- self.fail(msg or "File not available")
+ self.fail(_("File not available"))
elif err in ("freelimit", "size", "proxy"):
- self.fail(msg or "Premium account needed")
+ self.fail(_("Premium account needed"))
else:
if err in 'server':
self.setWait(600, False)
@@ -199,4 +193,4 @@ class ShareonlineBiz(Hoster):
self.setWait(300, True)
self.wait()
- self.retry(max_tries=25, reason=msg)
+ self.retry(max_tries=25, reason=err)