summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/ShareonlineBiz.py
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-03-04 08:31:48 +0100
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-03-04 08:31:48 +0100
commitf8fa74caeac0f824e2880a0c2a75340f048a6c2d (patch)
treea83cebcb75bf46ea618676f610ec388a917a5bcf /module/plugins/hoster/ShareonlineBiz.py
parentclosed #548 (diff)
downloadpyload-f8fa74caeac0f824e2880a0c2a75340f048a6c2d.tar.xz
share-online.biz (#550) partial fix, closed #551
Diffstat (limited to 'module/plugins/hoster/ShareonlineBiz.py')
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py88
1 files changed, 32 insertions, 56 deletions
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 2ecb76d75..70c1efe1d 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -43,7 +43,7 @@ class ShareonlineBiz(Hoster):
__name__ = "ShareonlineBiz"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?(share\-online\.biz|egoshare\.com)/(download.php\?id\=|dl/)[\w]+"
- __version__ = "0.24"
+ __version__ = "0.25"
__description__ = """Shareonline.biz Download Hoster"""
__author_name__ = ("spoob", "mkaay", "zoidberg")
__author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
@@ -55,21 +55,24 @@ class ShareonlineBiz(Hoster):
self.file_id = re.search(r"(id\=|/dl/)([a-zA-Z0-9]+)", self.pyfile.url).group(2)
self.pyfile.url = "http://www.share-online.biz/dl/" + self.file_id
- self.multiDL = False
+ self.resumeDownload = self.multiDL = self.premium
self.chunkLimit = 1
- if self.account and self.account.isPremium(self.user):
- self.multiDL = True
- def process(self, pyfile):
- self.downloadAPIData()
- pyfile.name = self.api_data["filename"]
- pyfile.sync()
-
- if self.account and self.account.isPremium(self.user):
+ def process(self, pyfile):
+ if self.premium:
self.handleAPIPremium()
- #self.handleWebsitePremium()
+ #web-download fallback removed - didn't work anyway
else:
self.handleFree()
+
+ check = self.checkDownload({"invalid" : re.compile("<strong>(This download ticket is.*?)</strong>"),
+ "error" : "Es ist ein unbekannter Fehler aufgetreten"})
+ if check == "invalid":
+ self.logError(self.lastCheck.group(1))
+ if self.premium: self.account.relogin()
+ self.retry(reason=_("Invalid download ticket"))
+ elif check == "error":
+ self.fail(reason=_("ShareOnline internal problems"))
def downloadAPIData(self):
api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1"
@@ -83,10 +86,12 @@ class ShareonlineBiz(Hoster):
self.offline()
self.api_data["filename"] = fields[2]
self.api_data["size"] = fields[3] # in bytes
- self.api_data["checksum"] = fields[4].strip().lower().replace("\n\n", "") # md5
+ self.api_data["md5"] = fields[4].strip().lower().replace("\n\n", "") # md5
- def handleFree(self):
- self.resumeDownload = False
+ def handleFree(self):
+ self.downloadAPIData()
+ self.pyfile.name = self.api_data["filename"]
+ self.pyfile.size = self.api_data["size"]
self.html = self.load(self.pyfile.url, cookies = True) #refer, stuff
self.setWait(3)
@@ -102,9 +107,7 @@ class ShareonlineBiz(Hoster):
found = re.search(r'var wait=(\d+);', self.html)
recaptcha = ReCaptcha(self)
- for i in range(5):
- #found = re.search(r'var dl="(.*?)";', self.html)
- #captcha = found.group(1).decode("base64").split('|')[-1]}
+ for i in range(5):
challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX")
self.setWait(int(found.group(1)) if found else 30)
response = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), post = {
@@ -124,65 +127,38 @@ class ShareonlineBiz(Hoster):
self.wait()
self.download(download_url)
-
- check = self.checkDownload({"invalid" : re.compile("<strong>(This download ticket is.*?)</strong>"),
- "error" : "Es ist ein unbekannter Fehler aufgetreten"})
- if check == "invalid":
- self.logError(self.lastCheck.group(1))
- self.retry(reason=_("Invalid download ticket"))
- elif check == "error":
- self.fail(reason=_("ShareOnline internal problems"))
-
- def handleAPIPremium(self): #should be working better
- self.resumeDownload = True
-
- info = self.account.getUserAPI(self.user, self.req)
- if info["dl"].lower() == "not_available":
- self.fail("DL API error")
- self.req.cj.setCookie("share-online.biz", "dl", info["dl"])
-
-
+ def handleAPIPremium(self): #should be working better
src = self.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=download&lid=%s" % (self.user, self.account.accounts[self.user]["password"], self.file_id), post={})
- dlinfo = {}
+ self.api_data = dlinfo = {}
for line in src.splitlines():
key, value = line.split(": ")
dlinfo[key.lower()] = value
- if not dlinfo["status"].lower() == "online":
+ self.logDebug(dlinfo)
+ if not dlinfo["status"] == "online":
self.offline()
+ self.pyfile.name = dlinfo["name"]
+ self.pyfile.size = dlinfo["size"]
+
dlLink = dlinfo["url"]
- if dlLink.startswith("/_dl.php"):
- self.log.debug("got invalid downloadlink, falling back")
- self.handleWebsitePremium()
+ if dlLink == "server_under_maintenance":
+ self.tempoffline()
else:
self.download(dlLink)
- def handleWebsitePremium(self): #seems to be buggy
- self.resumeDownload = False
-
- self.html = self.load(self.pyfile.url)
- if r"Die Nummer ist leider nicht richtig oder ausgelaufen!" in self.html:
- self.retry()
-
- try:
- download_url = re.search('loadfilelink\.decode\("(.*?)"\);', self.html, re.S).group(1)
- except:
- self.fail("Session issue")
-
- self.download(download_url)
-
def checksum(self, local_file):
- if self.api_data and self.api_data["checksum"]:
+ if self.api_data and "md5" in self.api_data and self.api_data["md5"]:
h = hashlib.md5()
f = open(local_file, "rb")
h.update(f.read())
f.close()
hexd = h.hexdigest()
- if hexd == self.api_data["checksum"]:
+ if hexd == self.api_data["md5"]:
return True, 0
else:
return False, 1
else:
+ self.logWarning("MD5 checksum missing")
return True, 5