diff options
-rw-r--r-- | module/plugins/Plugin.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/BezvadataCz.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/CrockoCom.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/DataHu.py | 6 | ||||
-rw-r--r-- | module/plugins/hoster/DataportCz.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/DepositfilesCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/FastshareCz.py | 19 | ||||
-rw-r--r-- | module/plugins/hoster/FilefactoryCom.py | 1 | ||||
-rw-r--r-- | module/plugins/hoster/FilerNet.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/LomafileCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/MegaRapidCz.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/OneFichierCom.py | 1 | ||||
-rw-r--r-- | module/plugins/hoster/ShareonlineBiz.py | 25 | ||||
-rw-r--r-- | module/plugins/hoster/TurbobitNet.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/UploadheroCom.py | 1 | ||||
-rw-r--r-- | module/plugins/internal/CaptchaService.py | 22 | ||||
-rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/XFSPHoster.py | 4 |
19 files changed, 47 insertions, 64 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 83571345c..0a4b6d44d 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -286,7 +286,7 @@ class Plugin(Base): raise Fail(reason) def error(self, reason=None, type="parse"): - raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ':' + str(reason) if reason else "")) + raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ': ' + str(reason) if reason else "")) if self.core.debug: print_exc() diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index dcf9bf293..ffd586f74 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -77,7 +77,7 @@ class BezvadataCz(SimpleHoster): def checkErrors(self): if 'images/button-download-disable.png' in self.html: - self.longWait(5 * 60, 24) # parallel dl limit + self.longWait(5 * 60, 24) #: parallel dl limit elif '<div class="infobox' in self.html: self.tempOffline() diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index f685d7452..15bf25ad2 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -22,7 +22,7 @@ class CrockoCom(SimpleHoster): FILE_SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>' OFFLINE_PATTERN = r'<h1>Sorry,<br />the page you\'re looking for <br />isn\'t here.</h1>|File not found' - CAPTCHA_URL_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';") + CAPTCHA_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';") FORM_PATTERN = r'<form method="post" action="([^"]+)">(.*?)</form>' FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>' @@ -35,7 +35,7 @@ class CrockoCom(SimpleHoster): self.fail("You need Premium membership to download this file.") for _ in xrange(5): - m = re.search(self.CAPTCHA_URL_PATTERN, self.html) + m = re.search(self.CAPTCHA_PATTERN, self.html) if m: url, wait_time = 'http://crocko.com' + m.group(1), m.group(2) self.wait(wait_time) diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index d3a13c54b..d76444d32 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -26,10 +26,12 @@ class DataHu(SimpleHoster): LINK_PATTERN = r'<div class="download_box_button"><a href="([^"]+)">' - def handleFree(self): + def setup(self): self.resumeDownload = True - self.html = self.load(self.pyfile.url, decode=True) + self.multiDL = self.premium + + def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m: url = m.group(1) diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index c79a21b8e..6fcbfc2ad 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -21,7 +21,7 @@ class DataportCz(SimpleHoster): FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.dataport.cz/file/\1')] - CAPTCHA_URL_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"' + CAPTCHA_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"' FREE_SLOTS_PATTERN = ur'Počet volných slotů: <span class="darkblue">(\d+)</span><br />' diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index d49b3fc94..ade91e7d4 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -102,8 +102,6 @@ class DepositfilesCom(SimpleHoster): self.retry(wait_time=60) def handlePremium(self): - self.html = self.load(self.pyfile.url, cookies=self.COOKIES) - if '<span class="html_download_api-gold_traffic_limit">' in self.html: self.logWarning("Download limit reached") self.retry(25, 60 * 60, "Download limit reached") diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 337977095..2a8d3af7d 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -64,20 +64,15 @@ class FastshareCz(SimpleHoster): header = self.load(self.pyfile.url, just_header=True) if "location" in header: url = header['location'] + elif self.CREDIT_PATTERN in self.html: + self.logWarning("Not enough traffic left") + self.resetAccount() else: - self.html = self.load(self.pyfile.url) - - self.getFileInfo() # - - if self.CREDIT_PATTERN in self.html: - self.logWarning("Not enough traffic left") - self.resetAccount() + m = re.search(self.PREMIUM_URL_PATTERN, self.html) + if m: + url = m.group(1) else: - m = re.search(self.PREMIUM_URL_PATTERN, self.html) - if m: - url = m.group(1) - else: - self.error("Premium URL") + self.error("Premium URL") self.logDebug("PREMIUM URL: " + url) self.download(url, disposition=True) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 0e422f108..a5942e261 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -38,7 +38,6 @@ class FilefactoryCom(SimpleHoster): def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) 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: diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index 6d62dfde8..7a8d49378 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -18,7 +18,7 @@ class FilerNet(SimpleHoster): __type__ = "hoster" __version__ = "0.07" - __pattern__ = r'https?://(?:www\.)?filer\.net/get/(\w+)' + __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+' __description__ = """Filer.net hoster plugin""" __license__ = "GPLv3" @@ -35,8 +35,7 @@ class FilerNet(SimpleHoster): # Wait between downloads m = re.search(r'musst du <span id="time">(\d+)</span> Sekunden warten', self.html) if m: - waittime = int(m.group(1)) - self.retry(3, waittime, "Wait between free downloads") + self.retry(wait_time=int(m.group(1)), reason="Wait between free downloads") self.html = self.load(self.pyfile.url, decode=True) diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py index 0c7e03484..1c86b16e8 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -24,7 +24,7 @@ class LomafileCom(XFSPHoster): OFFLINE_PATTERN = r'>(No such file|Software error:<)' TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' - CAPTCHA_URL_PATTERN = r'(http://lomafile\.com/captchas/[^"\']+)' + CAPTCHA_PATTERN = r'(http://lomafile\.com/captchas/[^"\']+)' getInfo = create_getInfo(LomafileCom) diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 06e6626c6..153f6ea8b 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -53,7 +53,7 @@ class MegaRapidCz(SimpleHoster): self.html = self.load(self.pyfile.url, decode=True) except BadHeader, e: self.account.relogin(self.user) - self.retry(max_tries=3, reason=str(e)) + self.retry(wait_time=60, reason=str(e)) m = re.search(self.LINK_PATTERN, self.html) if m: @@ -63,7 +63,7 @@ class MegaRapidCz(SimpleHoster): else: if re.search(self.ERR_LOGIN_PATTERN, self.html): self.relogin(self.user) - self.retry(max_tries=3, reason="User login failed") + self.retry(wait_time=60, reason="User login failed") elif re.search(self.ERR_CREDIT_PATTERN, self.html): self.fail("Not enough credit left") else: diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index e6e193b89..3f3d0a19a 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -37,7 +37,6 @@ class OneFichierCom(SimpleHoster): def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) m = re.search(self.WAIT_PATTERN, self.html) if m: wait_time = int(m.group(1)) + 1 #: One minute more than what the page displays to be safe 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: diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 8557e0ce7..ded926010 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -38,7 +38,7 @@ class TurbobitNet(SimpleHoster): LINK_PATTERN = r'(?P<url>/download/redirect/[^"\']+)' LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<' - CAPTCHA_URL_PATTERN = r'<img alt="Captcha" src="(.+?)"' + CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' def handleFree(self): @@ -78,7 +78,7 @@ class TurbobitNet(SimpleHoster): inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) else: - m = re.search(self.CAPTCHA_URL_PATTERN, self.html) + m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: self.error('captcha') captcha_url = m.group(1) @@ -165,7 +165,6 @@ class TurbobitNet(SimpleHoster): def handlePremium(self): self.logDebug("Premium download as user %s" % self.user) - self.html = self.load(self.pyfile.url) # Useless in 0.5 self.downloadFile() diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 3c26a0b8b..753ad6807 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -60,7 +60,6 @@ class UploadheroCom(SimpleHoster): def handlePremium(self): self.logDebug("%s: Use Premium Account" % self.__name__) - self.html = self.load(self.pyfile.url) link = re.search(self.PREMIUM_URL_PATTERN, self.html).group(1) self.logDebug("Downloading link : '%s'" % link) self.download(link) diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py index 28374899d..6d3fc0feb 100644 --- a/module/plugins/internal/CaptchaService.py +++ b/module/plugins/internal/CaptchaService.py @@ -16,7 +16,7 @@ class CaptchaService: KEY_PATTERN = None - key = None + key = None #: last key detected def __init__(self, plugin): @@ -28,7 +28,7 @@ class CaptchaService: if hasattr(self.plugin, "html") and self.plugin.html: html = self.plugin.html else: - errmsg = "%s html missing" % self.__name__ + errmsg = "%s html not found" % self.__name__ self.plugin.fail(errmsg) raise TypeError(errmsg) @@ -68,7 +68,7 @@ class ReCaptcha(CaptchaService): if hasattr(self.plugin, "html") and self.plugin.html: html = self.plugin.html else: - errmsg = "ReCaptcha html missing" + errmsg = "ReCaptcha not found" self.plugin.fail(errmsg) raise TypeError(errmsg) @@ -86,10 +86,10 @@ class ReCaptcha(CaptchaService): def challenge(self, key=None): if not key: - if self.key: + if self.detect_key(): key = self.key else: - errmsg = "ReCaptcha key missing" + errmsg = "ReCaptcha key not found" self.plugin.fail(errmsg) raise TypeError(errmsg) @@ -129,7 +129,7 @@ class AdsCaptcha(CaptchaService): if hasattr(self.plugin, "html") and self.plugin.html: html = self.plugin.html else: - errmsg = "AdsCaptcha html missing" + errmsg = "AdsCaptcha html not found" self.plugin.fail(errmsg) raise TypeError(errmsg) @@ -144,12 +144,12 @@ class AdsCaptcha(CaptchaService): return None - def challenge(self, key=None): #: key is tuple(CaptchaId, PublicKey) + def challenge(self, key=None): #: key is a tuple(CaptchaId, PublicKey) if not key: - if self.key: + if self.detect_key(): key = self.key else: - errmsg = "AdsCaptcha key missing" + errmsg = "AdsCaptcha key not found" self.plugin.fail(errmsg) raise TypeError(errmsg) @@ -187,10 +187,10 @@ class SolveMedia(CaptchaService): def challenge(self, key=None): if not key: - if self.key: + if self.detect_key(): key = self.key else: - errmsg = "SolveMedia key missing" + errmsg = "SolveMedia key not found" self.plugin.fail(errmsg) raise TypeError(errmsg) diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 2ea8d302b..613ffce1f 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -165,6 +165,6 @@ class SimpleCrypter(Crypter): #@TODO: remove in 0.4.10 def error(self, reason=None, type="parse"): - raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ':' + str(reason) if reason else "")) + raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ': ' + str(reason) if reason else "")) if self.core.debug: print_exc() diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 17543ba8d..a8a44d953 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -324,6 +324,6 @@ class SimpleHoster(Hoster): #@TODO: remove in 0.4.10 def error(self, reason=None, type="parse"): - raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ':' + str(reason) if reason else "")) + raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ': ' + str(reason) if reason else "")) if self.core.debug: print_exc() diff --git a/module/plugins/internal/XFSPHoster.py b/module/plugins/internal/XFSPHoster.py index 5d75e41a7..91a69116c 100644 --- a/module/plugins/internal/XFSPHoster.py +++ b/module/plugins/internal/XFSPHoster.py @@ -46,7 +46,7 @@ class XFSPHoster(SimpleHoster): OVR_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)' LINK_PATTERN = None #: final download url pattern - CAPTCHA_URL_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)' + CAPTCHA_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)' CAPTCHA_DIV_PATTERN = r'>Enter code.*?<div.*?>(.+?)</div>' RECAPTCHA_PATTERN = None SOLVEMEDIA_PATTERN = None @@ -306,7 +306,7 @@ class XFSPHoster(SimpleHoster): def handleCaptcha(self, inputs): - m = re.search(self.CAPTCHA_URL_PATTERN, self.html) + m = re.search(self.CAPTCHA_PATTERN, self.html) if m: captcha_url = m.group(1) inputs['code'] = self.decryptCaptcha(captcha_url) |