diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-22 19:47:00 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-22 19:47:00 +0200 |
commit | 1b096b2eb2634e8dea80b06ab9ecde206b198b35 (patch) | |
tree | c37727ef1c0c43c553725c6a4ae92022f48bcc23 /module/plugins/hoster/ShareonlineBiz.py | |
parent | [Keep2shareCC] Fix CAPTCHA_PATTERN (diff) | |
download | pyload-1b096b2eb2634e8dea80b06ab9ecde206b198b35.tar.xz |
Spare code cosmetics
Diffstat (limited to 'module/plugins/hoster/ShareonlineBiz.py')
-rw-r--r-- | module/plugins/hoster/ShareonlineBiz.py | 25 |
1 files changed, 9 insertions, 16 deletions
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: |