From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/hoster/ShareonlineBiz.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index a5bd9c250..78cc29fdb 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -144,7 +144,7 @@ class ShareonlineBiz(Hoster): else: self.correctCaptcha() - def handlePremium(self): # should be working better loading (account) api internally + 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", {"username": self.user, "password": self.account.accounts[self.user]["password"], @@ -179,9 +179,9 @@ class ShareonlineBiz(Hoster): msg = found.group(1) if found else "" self.logError(err, msg or "Unknown error occurred") - if err in ('invalid'): + if err == "invalid": self.fail(msg or "File not available") - elif err in ('freelimit', 'size', 'proxy'): + elif err in ("freelimit", "size", "proxy"): self.fail(msg or "Premium account needed") else: if err in 'server': -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/hoster/ShareonlineBiz.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 78cc29fdb..0e0676626 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -84,17 +84,17 @@ class ShareonlineBiz(Hoster): fields = src.split(";") self.api_data = {"fileid": fields[0], "status": fields[1]} - if not self.api_data["status"] == "OK": + 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['filename'] = fields[2] + 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.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.setWait(3) @@ -147,7 +147,7 @@ class ShareonlineBiz(Hoster): 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", - {"username": self.user, "password": self.account.accounts[self.user]["password"], + {"username": self.user, "password": self.account.accounts[self.user]['password'], "act": "download", "lid": self.file_id}) self.api_data = dlinfo = {} @@ -156,13 +156,13 @@ class ShareonlineBiz(Hoster): dlinfo[key.lower()] = value self.logDebug(dlinfo) - if not dlinfo["status"] == "online": + if not dlinfo['status'] == "online": self.offline() else: - self.pyfile.name = dlinfo["name"] - self.pyfile.size = int(dlinfo["size"]) + self.pyfile.name = dlinfo['name'] + self.pyfile.size = int(dlinfo['size']) - dlLink = dlinfo["url"] + dlLink = dlinfo['url'] if dlLink == "server_under_maintenance": self.tempOffline() else: -- cgit v1.2.3 From 05d258d98dd8c2faf0b769840fa1e3c4acccdce8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:25:14 +0200 Subject: Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 --- module/plugins/hoster/ShareonlineBiz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 0e0676626..246d265c5 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -171,7 +171,7 @@ class ShareonlineBiz(Hoster): def checkErrors(self): found = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL) - if not found: + if found is None: return err = found.group(1) -- cgit v1.2.3 From 9395182da7afed55a29bde1c7cbefe4204e783f0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:02:09 +0200 Subject: Store all re.search/match object as "m" instead "found" --- module/plugins/hoster/ShareonlineBiz.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 246d265c5..a31b7c701 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -103,12 +103,12 @@ class ShareonlineBiz(Hoster): self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True) self.checkErrors() - found = re.search(r'var wait=(\d+);', self.html) + m = re.search(r'var wait=(\d+);', self.html) recaptcha = ReCaptcha(self) for _ in xrange(5): challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX") - self.setWait(int(found.group(1)) if found else 30) + 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, @@ -170,13 +170,13 @@ class ShareonlineBiz(Hoster): self.download(dlLink) def checkErrors(self): - found = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL) - if found is None: + m = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL) + if m is None: return - err = found.group(1) - found = re.search(self.ERROR_INFO_PATTERN, self.html) - msg = found.group(1) if found else "" + 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") if err == "invalid": -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hoster/ShareonlineBiz.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index a31b7c701..feaa95603 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- import re + from time import time -from module.plugins.Hoster import Hoster from module.network.RequestFactory import getURL +from module.plugins.Hoster import Hoster from module.plugins.Plugin import chunks from module.plugins.internal.CaptchaService import ReCaptcha @@ -38,14 +39,17 @@ def getInfo(urls): class ShareonlineBiz(Hoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download.php\?id=|dl/)(?P\w+)' __version__ = "0.40" + + __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download.php\?id=|dl/)(?P\w+)' + __description__ = """Shareonline.biz hoster plugin""" __author_name__ = ("spoob", "mkaay", "zoidberg", "Walter Purcaro") __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz", "vuolter@gmail.com") ERROR_INFO_PATTERN = r'

Information:

\s*
\s*(.*?)' + def setup(self): # range request not working? # api supports resume, only one chunk -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/hoster/ShareonlineBiz.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index feaa95603..fa5cd3ffe 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -44,8 +44,11 @@ class ShareonlineBiz(Hoster): __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download.php\?id=|dl/)(?P\w+)' __description__ = """Shareonline.biz hoster plugin""" - __author_name__ = ("spoob", "mkaay", "zoidberg", "Walter Purcaro") - __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz", "vuolter@gmail.com") + __authors__ = [("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] + ERROR_INFO_PATTERN = r'

Information:

\s*
\s*(.*?)' -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/hoster/ShareonlineBiz.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index fa5cd3ffe..f3290af9e 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -44,6 +44,7 @@ class ShareonlineBiz(Hoster): __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download.php\?id=|dl/)(?P\w+)' __description__ = """Shareonline.biz hoster plugin""" + __license__ = "GPLv3" __authors__ = [("spoob", "spoob@pyload.org"), ("mkaay", "mkaay@mkaay.de"), ("zoidberg", "zoidberg@mujmail.cz"), -- cgit v1.2.3 From c5d1a4fd8943877c6d2eb3843e0de725dba5191e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:09:53 +0200 Subject: Pattern update 2 --- module/plugins/hoster/ShareonlineBiz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index f3290af9e..cfb1d6325 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -41,7 +41,7 @@ class ShareonlineBiz(Hoster): __type__ = "hoster" __version__ = "0.40" - __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download.php\?id=|dl/)(?P\w+)' + __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P\w+)' __description__ = """Shareonline.biz hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 2ae91b81a2f12a1c9b1f78524df78a2b3f1ef494 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Oct 2014 14:52:42 +0200 Subject: Update hosters to self.error --- module/plugins/hoster/ShareonlineBiz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index cfb1d6325..7a73ab316 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -39,7 +39,7 @@ def getInfo(urls): class ShareonlineBiz(Hoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.41" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P\w+)' @@ -134,7 +134,7 @@ class ShareonlineBiz(Hoster): download_url = response.decode("base64") self.logDebug(download_url) if not download_url.startswith("http://"): - self.parseError("download url") + self.error("download url") self.wait() self.download(download_url) -- cgit v1.2.3 From 1b096b2eb2634e8dea80b06ab9ecde206b198b35 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Oct 2014 19:47:00 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/ShareonlineBiz.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 7a73ab316..b7c112a45 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -55,38 +55,28 @@ class ShareonlineBiz(Hoster): 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 + 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) fields = src.split(";") @@ -96,15 +86,16 @@ class ShareonlineBiz(Hoster): 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() @@ -152,6 +143,7 @@ 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", @@ -177,6 +169,7 @@ 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: -- cgit v1.2.3 From 8cde8385b0224f8fa26758f6c2b6b782e5fb3663 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 23 Oct 2014 22:34:36 +0200 Subject: Call error instead fail in some plugins --- module/plugins/hoster/ShareonlineBiz.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index b7c112a45..565e0364a 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -176,9 +176,10 @@ class ShareonlineBiz(Hoster): 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") -- cgit v1.2.3 From 4da90891eb2544ac15a7d512aba8cb357f68ee5f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 01:11:29 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/ShareonlineBiz.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 565e0364a..4d3697a09 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -123,9 +123,8 @@ class ShareonlineBiz(Hoster): self.fail("No valid captcha solution received") download_url = response.decode("base64") - self.logDebug(download_url) if not download_url.startswith("http://"): - self.error("download url") + self.error("Wrong download url") self.wait() self.download(download_url) -- cgit v1.2.3 From 1c4bf83881d2a22da3773666a580d51f6b57bfd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 03:07:21 +0200 Subject: Avoid gettext conflict due variable `_` --- module/plugins/hoster/ShareonlineBiz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 4d3697a09..5441efce1 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -105,7 +105,7 @@ 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={ -- cgit v1.2.3 From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 26 Oct 2014 02:31:54 +0200 Subject: Extend translation support in plugins + a lot of code cosmetics and typo fixes --- module/plugins/hoster/ShareonlineBiz.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 5441efce1..f27be7f9c 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -120,11 +120,11 @@ class ShareonlineBiz(Hoster): self.invalidCaptcha() else: self.invalidCaptcha() - self.fail("No valid captcha solution received") + self.fail(_("No valid captcha solution received")) download_url = response.decode("base64") if not download_url.startswith("http://"): - self.error("Wrong download url") + self.error(_("Wrong download url")) self.wait() self.download(download_url) @@ -181,9 +181,9 @@ class ShareonlineBiz(Hoster): 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) @@ -193,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) -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/hoster/ShareonlineBiz.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index f27be7f9c..2f4b04ce2 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -37,18 +37,18 @@ def getInfo(urls): class ShareonlineBiz(Hoster): - __name__ = "ShareonlineBiz" - __type__ = "hoster" + __name__ = "ShareonlineBiz" + __type__ = "hoster" __version__ = "0.41" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P\w+)' __description__ = """Shareonline.biz hoster plugin""" - __license__ = "GPLv3" - __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'

Information:

\s*
\s*(.*?)' -- cgit v1.2.3 From c9e31d875d32de31e54959b82bc35eff2b3e0f3f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 10 Nov 2014 00:19:51 +0100 Subject: Code cosmetics --- module/plugins/hoster/ShareonlineBiz.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 2f4b04ce2..78a27558b 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/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(";") @@ -77,9 +77,9 @@ class ShareonlineBiz(Hoster): 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) + 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": @@ -108,12 +108,12 @@ class ShareonlineBiz(Hoster): 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: @@ -122,7 +122,7 @@ class ShareonlineBiz(Hoster): self.invalidCaptcha() self.fail(_("No valid captcha solution received")) - download_url = response.decode("base64") + download_url = res.decode("base64") if not download_url.startswith("http://"): self.error(_("Wrong download url")) @@ -145,12 +145,12 @@ class ShareonlineBiz(Hoster): 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 -- cgit v1.2.3 From 9dba25814346190ac9e86fbbd6af1f101d6e96b3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 1 Dec 2014 18:20:37 +0100 Subject: [ShareonlineBiz] Extend SimpleHoster --- module/plugins/hoster/ShareonlineBiz.py | 184 +++++++++++++++----------------- 1 file changed, 87 insertions(+), 97 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 78a27558b..91fc989c9 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -3,43 +3,18 @@ import re from time import time +from urllib import unquote +from urlparse import urlparse from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.plugins.Plugin import chunks from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -def getInfo(urls): - api_url_base = "http://api.share-online.biz/linkcheck.php" - - urls = [url.replace("https://", "http://") for url in 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 - html = getURL(api_url_base, post=api_param_file, decode=True) - result = [] - for i, res in enumerate(html.split("\n")): - if not res: - continue - fields = res.split(";") - - if fields[1] == "OK": - status = 2 - elif fields[1] in ("DELETED", "NOT FOUND"): - status = 1 - else: - status = 3 - - result.append((fields[2], int(fields[3]), status, chunk[i])) - yield result - - -class ShareonlineBiz(Hoster): +class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.41" + __version__ = "0.42" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P\w+)' @@ -51,110 +26,118 @@ class ShareonlineBiz(Hoster): ("Walter Purcaro", "vuolter@gmail.com")] - ERROR_INFO_PATTERN = r'

Information:

\s*
\s*(.*?)' + URL_REPLACEMENTS = [(__pattern__ + ".*", "http://www.share-online.biz/dl/\g")] + ERROR_INFO_PATTERN = r'

Information:

\s*
\s*(.*?)' - def setup(self): - 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 + @classmethod + def getInfo(cls, url="", html=""): + info = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url} - self.check_data = None + if url: + info.update(re.match(cls.__pattern__, url).groupdict()) + api_url = "http://api.share-online.biz/linkcheck.php?md5=1" + html = getURL(api_url, cookies=False, post={"links": self.info['pattern']['ID']}, decode=True) + field = html.split(";") - def process(self, pyfile): - if self.premium: - self.handlePremium() - else: - self.handleFree() + if field[1] is "OK": + info['fileid'] = field[0] + info['status'] = 2 + info['filename'] = field[2] + info['size'] = field[3] #: in bytes + info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 - if self.api_data: - self.check_data = {"size": int(self.api_data['size']), "md5": self.api_data['md5']} + elif field[1] in ("DELETED", "NOT FOUND"): + info['status'] = 1 + return info - 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 - html = self.load(api_url_base, cookies=False, post=api_param_file, decode=True) - - 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 + def setup(self): + self.resumeDownload = self.premium + self.multiDL = False - 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.setWait(3) - self.wait() - - self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True) - self.checkErrors() - - m = re.search(r'var wait=(\d+);', self.html) + def handleCaptcha(self): recaptcha = ReCaptcha(self) + for _i in xrange(5): - challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX") + challenge, response = recaptcha.challenge() + + m = re.search(r'var wait=(\d+);', self.html) self.setWait(int(m.group(1)) if m else 30) + res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), - post={'dl_free': '1', + post={'dl_free' : "1", 'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': response}) - + 'recaptcha_response_field' : response}) if not res == '0': self.correctCaptcha() - break + return res else: self.invalidCaptcha() else: self.invalidCaptcha() self.fail(_("No valid captcha solution received")) + + def handleFree(self): + self.html = self.load(self.pyfile.url, cookies=True) #: refer, stuff + + self.wait(3) + + self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True) + + self.checkErrors() + + res = self.handleCaptcha() + download_url = res.decode("base64") + if not download_url.startswith("http://"): self.error(_("Wrong download url")) self.wait() + self.download(download_url) + + def checkFile(self): # check download check = self.checkDownload({ - "cookie": re.compile(r'
Share-Online") + 'empty' : re.compile(r"^$"), + 'cookie': re.compile(r'
Share-Online") }) - if check == "cookie": + + if check == "empty": + self.fail(_("Empty file")) + + elif check == "cookie": self.invalidCaptcha() - self.retry(5, 60, "Cookie failure") + self.retry(5, 60, _("Cookie failure")) + elif check == "fail": self.invalidCaptcha() - self.retry(5, 5 * 60, "Download failed") - else: - self.correctCaptcha() + self.retry(5, 5 * 60, _("Download failed")) def handlePremium(self): #: should be working better loading (account) api internally self.account.getAccountInfo(self.user, True) + 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}) + "act": "download", "lid": self.info['fileid']}) self.api_data = dlinfo = {} + for line in html.splitlines(): key, value = line.split(": ") dlinfo[key.lower()] = value self.logDebug(dlinfo) + if not dlinfo['status'] == "online": self.offline() else: @@ -162,6 +145,7 @@ class ShareonlineBiz(Hoster): self.pyfile.size = int(dlinfo['size']) dlLink = dlinfo['url'] + if dlLink == "server_under_maintenance": self.tempOffline() else: @@ -174,23 +158,29 @@ class ShareonlineBiz(Hoster): if m is None: return - err = m.group(1) + errmsg = m.group(1).lower() + try: - self.logError(err, re.search(self.ERROR_INFO_PATTERN, self.html).group(1)) + self.logError(errmsg, re.search(self.ERROR_INFO_PATTERN, self.html).group(1)) except: - self.logError(err, "Unknown error occurred") + self.logError("Unknown error occurred", errmsg) - if err == "invalid": + if errmsg is "invalid": self.fail(_("File not available")) - elif err in ("freelimit", "size", "proxy"): + + elif errmsg in ("freelimit", "size", "proxy"): self.fail(_("Premium account needed")) + + elif errmsg in ("expired", "server"): + self.retry(wait_time=600, reason=errmsg) + + elif 'slot' in errmsg: + self.wantReconnect = True + self.retry(24, 3600, errmsg) + else: - if err in 'server': - self.setWait(600, False) - elif err in 'expired': - self.setWait(30, False) - else: - self.setWait(300, True) + self.wantReconnect = True + self.retry(wait_time=60, reason=errmsg) + - self.wait() - self.retry(max_tries=25, reason=err) +getInfo = create_getInfo(ShareonlineBiz) -- cgit v1.2.3 From b580fff84a0c159b5ce9b6734baa0726b4cfd7af Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 2 Dec 2014 16:24:39 +0100 Subject: [ShareonlineBiz] Fix getInfo --- module/plugins/hoster/ShareonlineBiz.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 91fc989c9..1c5567536 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.43" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P\w+)' @@ -36,10 +36,10 @@ class ShareonlineBiz(SimpleHoster): info = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url} if url: - info.update(re.match(cls.__pattern__, url).groupdict()) + info['pattern'] = re.match(cls.__pattern__, url).groupdict() api_url = "http://api.share-online.biz/linkcheck.php?md5=1" - html = getURL(api_url, cookies=False, post={"links": self.info['pattern']['ID']}, decode=True) + html = getURL(api_url, cookies=False, post={"links": info['pattern']['ID']}, decode=True) field = html.split(";") if field[1] is "OK": -- cgit v1.2.3 From e40872c7c8912dd844e0dd9f76d1301f9bc2dafb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 2 Dec 2014 23:30:31 +0100 Subject: [ShareonlineBiz] Fix getInfo (2) --- module/plugins/hoster/ShareonlineBiz.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 1c5567536..f821cd244 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.44" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P\w+)' @@ -38,14 +38,15 @@ class ShareonlineBiz(SimpleHoster): if url: info['pattern'] = re.match(cls.__pattern__, url).groupdict() - api_url = "http://api.share-online.biz/linkcheck.php?md5=1" - html = getURL(api_url, cookies=False, post={"links": info['pattern']['ID']}, decode=True) - field = html.split(";") + field = getURL("http://api.share-online.biz/linkcheck.php", + get={'md5': "1"}, + post={'links': info['pattern']['ID']}, + decode=True).split(";") - if field[1] is "OK": + if field[1] == "OK": info['fileid'] = field[0] info['status'] = 2 - info['filename'] = field[2] + info['name'] = field[2] info['size'] = field[3] #: in bytes info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 @@ -103,6 +104,7 @@ class ShareonlineBiz(SimpleHoster): self.download(download_url) + def checkFile(self): # check download check = self.checkDownload({ -- cgit v1.2.3 From e60f9d3480b3753f58e82d55178d180c7c933f6a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 3 Dec 2014 00:28:52 +0100 Subject: [ShareonlineBiz] Fix recaptcha --- module/plugins/hoster/ShareonlineBiz.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index f821cd244..d52328fd6 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -28,6 +28,8 @@ class ShareonlineBiz(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", "http://www.share-online.biz/dl/\g")] + RECAPTCHA_KEY = "6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX" + ERROR_INFO_PATTERN = r'

Information:

\s*
\s*(.*?)' @@ -65,7 +67,7 @@ class ShareonlineBiz(SimpleHoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge() + challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) m = re.search(r'var wait=(\d+);', self.html) self.setWait(int(m.group(1)) if m else 30) -- cgit v1.2.3 From 5a23de6f32dc99960cccd634d2fd2cc47c34be2a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 5 Dec 2014 23:08:44 +0100 Subject: Code cosmetics about checkErrors --- module/plugins/hoster/ShareonlineBiz.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index d52328fd6..1cb651b12 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -160,6 +160,7 @@ class ShareonlineBiz(SimpleHoster): def checkErrors(self): m = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL) if m is None: + self.info.pop('error', None) return errmsg = m.group(1).lower() -- cgit v1.2.3 From 3d27f5ccee412d38102873a5b02e3f236375eb97 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 16 Dec 2014 03:44:15 +0100 Subject: Update plugins (2) --- module/plugins/hoster/ShareonlineBiz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 1cb651b12..c40e8560f 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -48,7 +48,7 @@ class ShareonlineBiz(SimpleHoster): if field[1] == "OK": info['fileid'] = field[0] info['status'] = 2 - info['name'] = field[2] + info['name'] = field[2] info['size'] = field[3] #: in bytes info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 -- cgit v1.2.3 From 4e9c8f7ab1269966a9eac9e1b6363f5458f9f970 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 18 Dec 2014 16:07:21 +0100 Subject: Update checkFile routine in some hoster plugins --- module/plugins/hoster/ShareonlineBiz.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/ShareonlineBiz.py') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index c40e8560f..dc3d5093c 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.45" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P\w+)' @@ -108,17 +108,14 @@ class ShareonlineBiz(SimpleHoster): def checkFile(self): - # check download + super(ShareonlineBiz, self).checkFile() + check = self.checkDownload({ - 'empty' : re.compile(r"^$"), 'cookie': re.compile(r'
Share-Online") }) - if check == "empty": - self.fail(_("Empty file")) - - elif check == "cookie": + if check == "cookie": self.invalidCaptcha() self.retry(5, 60, _("Cookie failure")) -- cgit v1.2.3