diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-03-04 08:31:48 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-03-04 08:31:48 +0100 |
commit | f8fa74caeac0f824e2880a0c2a75340f048a6c2d (patch) | |
tree | a83cebcb75bf46ea618676f610ec388a917a5bcf | |
parent | closed #548 (diff) | |
download | pyload-f8fa74caeac0f824e2880a0c2a75340f048a6c2d.tar.xz |
-rw-r--r-- | module/plugins/accounts/ShareonlineBiz.py | 58 | ||||
-rw-r--r-- | module/plugins/hoster/FilefactoryCom.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/ShareonlineBiz.py | 88 | ||||
-rw-r--r-- | module/plugins/hoster/TurbobitNet.py | 34 |
4 files changed, 76 insertions, 108 deletions
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 426f5a6a9..70922b239 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -23,54 +23,34 @@ import re class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" - __version__ = "0.21" + __version__ = "0.22" __type__ = "account" __description__ = """share-online.biz account plugin""" - __author_name__ = ("mkaay") - __author_mail__ = ("mkaay@mkaay.de") + __author_name__ = ("mkaay", "zoidberg") + __author_mail__ = ("mkaay@mkaay.de", "zoidberg@mujmail.cz") - def getUserAPI(self, user, req): + info_threshold = 60 + + def loadAccountInfo(self, user, req): src = req.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=userDetails" % (user, self.accounts[user]["password"])) + info = {} for line in src.splitlines(): if "=" in line: key, value = line.split("=") info[key] = value - return info - - def loadAccountInfo(self, user, req): - try: - info = self.getUserAPI(user, req) - return {"validuntil": int(info["expire_date"]), "trafficleft": -1, "premium": not info["group"] == "Sammler"} - except: - pass - - #fallback - src = req.load("http://www.share-online.biz/members.php?setlang=en") - validuntil = re.search(r'<td align="left"><b>Package Expire Date:</b></td>\s*<td align="left">(\d+/\d+/\d+)</td>', src) - if validuntil: - validuntil = int(mktime(strptime(validuntil.group(1), "%m/%d/%y"))) - else: - validuntil = -1 - - acctype = re.search(r'<td align="left" ><b>Your Package:</b></td>\s*<td align="left">\s*<b>(.*?)</b>\s*</td>', src) - if acctype: - if acctype.group(1) == "Collector account (free)": - premium = False - else: - premium = True - - tmp = {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - return tmp + + if "dl" in info and info["dl"].lower() != "not_available": + req.cj.setCookie("share-online.biz", "dl", info["dl"]) + if "a" in info and info["a"].lower() != "not_available": + req.cj.setCookie("share-online.biz", "a", info["a"]) + + return {"validuntil": int(info["expire_date"]) if "expire_date" in info else -1, + "trafficleft": -1, + "premium": True if ("dl" in info or "a" in info) and (info["group"] == "Premium") else False} def login(self, user, data, req): - post_vars = { - "act": "login", - "location": "index.php", - "dieseid": "", - "user": user, - "pass": data["password"], - "login": "Login" - } req.lastURL = "http://www.share-online.biz/" - req.load("https://www.share-online.biz/login.php", cookies=True, post=post_vars) + req.load("https://www.share-online.biz/user/login", cookies=True, post={ + "user": user, + "pass": data["password"]}) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 33e055175..4f6666675 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -34,7 +34,7 @@ class FilefactoryCom(Hoster): __name__ = "FilefactoryCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?filefactory\.com/file/(?P<id>[a-zA-Z0-9]+).*" # URLs given out are often longer but this is the requirement - __version__ = "0.32" + __version__ = "0.33" __description__ = """Filefactory.Com File Download Hoster""" __author_name__ = ("paulking", "zoidberg") @@ -88,6 +88,8 @@ class FilefactoryCom(Hoster): def handleFree(self): if "Currently only Premium Members can download files larger than" in self.html: self.fail("File too large for free download") + elif "All free download slots on this server are currently in use" in self.html: + self.retry(50, 900, "All free slots are busy") # Check Id self.check = re.search(self.FILE_CHECK_PATTERN, self.html).group('check') 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 diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 91cfd5145..95fcae7f2 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -26,28 +26,28 @@ from pycurl import HTTPHEADER class TurbobitNet(SimpleHoster): __name__ = "TurbobitNet" __type__ = "hoster" - __pattern__ = r"http://(?:\w*\.)?turbobit.net/(?P<ID>\w+).*" - __version__ = "0.02" + __pattern__ = r"http://(?:\w*\.)?turbobit.net/(?:download/free/)?(?P<ID>\w+).*" + __version__ = "0.03" __description__ = """Turbobit.net plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - FILE_SIZE_PATTERN = r"</span>\s*\((?P<S>[^\)]+)\)\s*</h1>" - FILE_NAME_PATTERN = r'<meta name="keywords" content="\s*(?P<N>[^,]+)' + FILE_INFO_PATTERN = r"<span class='file-icon1[^>]*>(?P<N>[^<]+)</span>\s*\((?P<S>[^\)]+)\)\s*</h1>" #long filenames are shortened + FILE_NAME_PATTERN = r'<meta name="keywords" content="\s*(?P<N>[^,]+)' #full name but missing on page2 FILE_OFFLINE_PATTERN = r'<h2>File Not Found</h2>' FILE_URL_REPLACEMENTS = [(r'(?<=http://)(.*?)(?=turbobit.net/)', '')] SH_COOKIES = [("turbobit.net", "user_lang", "en")] CAPTCHA_KEY_PATTERN = r'src="http://api\.recaptcha\.net/challenge\?k=([^"]+)"' DOWNLOAD_URL_PATTERN = r'(?P<url>/download/redirect/[^"\']+)' - LIMIT_WAIT_PATTERN = r'<div id="time-limit-text">\s*.*?<span id=\'timeout\'>(\d+)</span> seconds' + LIMIT_WAIT_PATTERN = r'<div id="time-limit-text">\s*.*?<span id=\'timeout\'>(\d+)</span> seconds' + CAPTCHA_SRC_PATTERN = r'<img alt="Captcha" src="(.*?)"' - def handleFree(self): + def handleFree(self): self.url = "http://turbobit.net/download/free/%s" % self.file_info['ID'] - self.html = self.load(self.url) + if not '/download/free/' in self.pyfile.url: + self.html = self.load(self.url) - found = re.search(self.CAPTCHA_KEY_PATTERN, self.html) - captcha_key = found.group(1) if found else '6LcTGLoSAAAAAHCWY9TTIrQfjUlxu6kZlTYP50_c' recaptcha = ReCaptcha(self) for i in range(5): @@ -57,11 +57,21 @@ class TurbobitNet(SimpleHoster): self.wait() self.retry() - action, inputs = self.parseHtmlForm("action='#'") - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) + action, inputs = self.parseHtmlForm("action='#'") if not inputs: self.parseError("inputs") self.logDebug(inputs) + + if inputs['captcha_type'] == 'recaptcha': + found = re.search(self.CAPTCHA_KEY_PATTERN, self.html) + captcha_key = found.group(1) if found else '6LcTGLoSAAAAAHCWY9TTIrQfjUlxu6kZlTYP50_c' + inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) + else: + found = re.search(self.CAPTCHA_SRC_PATTERN, self.html) + if not found: self.parseError('captcha') + captcha_url = found.group(1) + inputs['captcha_response'] = self.decryptCaptcha(captcha_url) + self.logDebug(inputs) self.html = self.load(self.url, post = inputs) if not "<div class='download-timer-header'>" in self.html: @@ -77,7 +87,7 @@ class TurbobitNet(SimpleHoster): self.setWait(60, False) self.wait() - self.html = self.load("http://turbobit.net/download/getLinkAfterTimeout/" + self.file_info['ID']) + self.html = self.load("http://turbobit.net/download/getLinkTimeout/" + self.file_info['ID']) self.downloadFile() def handlePremium(self): |