From 7f1467c64fe5c0e902498b3252afd65cb68ed2f9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 11 Apr 2014 12:17:38 +0200 Subject: Use wait to set time in SimpleHoster plugins Merges vuolter/pyload@bb002ac --- module/plugins/hoster/BayfilesCom.py | 6 ++---- module/plugins/hoster/BezvadataCz.py | 5 ++--- module/plugins/hoster/BitshareCom.py | 10 +++------- module/plugins/hoster/CatShareNet.py | 3 +-- module/plugins/hoster/CrockoCom.py | 3 +-- module/plugins/hoster/CzshareCom.py | 6 +++--- module/plugins/hoster/DataportCz.py | 3 +-- module/plugins/hoster/DateiTo.py | 6 ++---- module/plugins/hoster/DepositfilesCom.py | 7 ++----- module/plugins/hoster/EgoFilesCom.py | 3 +-- module/plugins/hoster/EuroshareEu.py | 4 ++-- module/plugins/hoster/ExtabitCom.py | 6 ++---- module/plugins/hoster/FilefactoryCom.py | 3 +-- module/plugins/hoster/FilepostCom.py | 3 +-- module/plugins/hoster/FlyFilesNet.py | 3 +-- module/plugins/hoster/FourSharedCom.py | 3 +-- module/plugins/hoster/FshareVn.py | 3 +-- module/plugins/hoster/GigapetaCom.py | 3 +-- module/plugins/hoster/GooIm.py | 3 +-- module/plugins/hoster/IfolderRu.py | 3 +-- module/plugins/hoster/LetitbitNet.py | 9 +++------ module/plugins/hoster/LuckyShareNet.py | 3 +-- module/plugins/hoster/NowDownloadEu.py | 3 +-- module/plugins/hoster/OneFichierCom.py | 3 +-- module/plugins/hoster/TurbobitNet.py | 3 +-- module/plugins/hoster/UlozTo.py | 3 +-- module/plugins/hoster/UnibytesCom.py | 6 ++---- module/plugins/hoster/UploadheroCom.py | 3 +-- module/plugins/hoster/UploadingCom.py | 6 ++---- module/plugins/hoster/XFileSharingPro.py | 6 ++---- 30 files changed, 45 insertions(+), 86 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index f1b36221f..2254ffb1e 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -43,8 +43,7 @@ class BayfilesCom(SimpleHoster): def handleFree(self): found = re.search(self.WAIT_PATTERN, self.html) if found: - self.setWait(int(found.group(1)) * 60) - self.wait() + self.wait(int(found.group(1)) * 60) self.retry() # Get download token @@ -61,8 +60,7 @@ class BayfilesCom(SimpleHoster): if not "token" in response or not response['token']: self.fail('No token') - self.setWait(int(delay)) - self.wait() + self.wait(int(delay)) self.html = self.load('https://bayfiles.com/ajax_download', get={ "token": response['token'], diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index 78836fa44..8a4bc559c 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -82,14 +82,13 @@ class BezvadataCz(SimpleHoster): #countdown found = re.search(r'id="countdown">(\d\d):(\d\d)<', self.html) wait_time = (int(found.group(1)) * 60 + int(found.group(2)) + 1) if found else 120 - self.setWait(wait_time, False) - self.wait() + self.wait(wait_time, False) self.download(url) def checkErrors(self): if 'images/button-download-disable.png' in self.html: - self.longWait(300, 24) # parallel dl limit + self.longWait(5 * 60, 24) # parallel dl limit elif '
0: self.logDebug("Waiting %d seconds." % wait) if wait < 120: - self.setWait(wait, False) - self.wait() + self.wait(wait, False) else: - self.setWait(wait - 55, True) - self.wait() + self.wait(wait - 55, True) self.retry() # Resolve captcha diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 4419779e3..e0a424b93 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -23,8 +23,7 @@ class CatShareNet(SimpleHoster): found = re.search(self.SECONDS_PATTERN, self.html) seconds = int(found.group(1)) self.logDebug("Seconds found", seconds) - self.setWait(seconds + 1) - self.wait() + self.wait(seconds + 1) recaptcha = ReCaptcha(self) challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY) post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": code} diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 569cef01d..8bd21f041 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -35,8 +35,7 @@ class CrockoCom(SimpleHoster): found = re.search(self.CAPTCHA_URL_PATTERN, self.html) if found: url, wait_time = 'http://crocko.com' + found.group(1), found.group(2) - self.setWait(wait_time) - self.wait() + self.wait(wait_time) self.html = self.load(url) else: break diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 763bbbd29..4082ed0b9 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -96,7 +96,7 @@ class CzshareCom(SimpleHoster): # get download ticket and parse html self.html = self.load(parsed_url, cookies=True, decode=True) if re.search(self.MULTIDL_PATTERN, self.html): - self.longWait(300, 12) + self.longWait(5 * 60, 12) try: form = re.search(self.FREE_FORM_PATTERN, self.html, re.DOTALL).group(1) @@ -114,7 +114,7 @@ class CzshareCom(SimpleHoster): if u"
  • Zadaný ověřovací kód nesouhlasí!
  • " in self.html: self.invalidCaptcha() elif re.search(self.MULTIDL_PATTERN, self.html): - self.longWait(300, 12) + self.longWait(5 * 60, 12) else: self.correctCaptcha() break @@ -150,7 +150,7 @@ class CzshareCom(SimpleHoster): if check == "credit": self.resetAccount() elif check == "multi_dl": - self.longWait(300, 12) + self.longWait(5 * 60, 12) elif check == "captcha_err": self.invalidCaptcha() self.retry() diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index ebd5d13a8..000bd79a7 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -58,8 +58,7 @@ class DataportCz(SimpleHoster): raise PluginParseError('invalid captcha') elif check == "slot": self.logDebug("No free slots - wait 60s and retry") - self.setWait(60, False) - self.wait() + self.wait(60, False) self.html = self.load(self.pyfile.url, decode=True) continue else: diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index c08b775a4..f39f6a6fb 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -81,17 +81,15 @@ class DateiTo(SimpleHoster): if found: found = re.search(self.WAIT_PATTERN, self.html) wait_time = int(found.group(1)) if found else 30 - self.setWait(wait_time + 1, False) - self.wait(300) + self.wait(wait_time + 1, False) self.retry() def doWait(self): found = re.search(self.WAIT_PATTERN, self.html) wait_time = int(found.group(1)) if found else 30 - self.setWait(wait_time + 1, False) self.load('http://datei.to/ajax/download.php', post={'P': 'Ads'}) - self.wait() + self.wait(wait_time + 1, False) getInfo = create_getInfo(DateiTo) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index f1b3d18e5..a05dd983a 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -33,17 +33,14 @@ class DepositfilesCom(SimpleHoster): if re.search(r'File is checked, please try again in a minute.', self.html) is not None: self.logInfo("DepositFiles.com: The file is being checked. Waiting 1 minute.") - self.setWait(61) - self.wait() + self.wait(61) self.retry() wait = re.search(r'html_download_api-limit_interval\">(\d+)', self.html) if wait: wait_time = int(wait.group(1)) self.logInfo("%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time)) - self.setWait(wait_time) - self.wantReconnect = True - self.wait() + self.wait(wait_time, True) self.retry() wait = re.search(r'>Try in (\d+) minutes or use GOLD account', self.html) diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py index 5d02d244e..035102c3c 100644 --- a/module/plugins/hoster/EgoFilesCom.py +++ b/module/plugins/hoster/EgoFilesCom.py @@ -57,8 +57,7 @@ class EgoFilesCom(SimpleHoster): if 'For next free download you have to wait' in self.html: m = re.search(self.WAIT_TIME_PATTERN, self.html).groupdict('0') waittime = int(m['m']) * 60 + int(m['s']) - self.setWait(waittime, True) - self.wait() + self.wait((waittime, True) downloadURL = '' recaptcha = ReCaptcha(self) diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 646e8607e..45e10880e 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -59,7 +59,7 @@ class EuroshareEu(SimpleHoster): def handleFree(self): if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: - self.longWait(300, 12) + self.longWait(5 * 60, 12) found = re.search(self.FREE_URL_PATTERN, self.html) if found is None: @@ -70,7 +70,7 @@ class EuroshareEu(SimpleHoster): check = self.checkDownload({"multi_dl": re.compile(self.ERR_PARDL_PATTERN)}) if check == "multi_dl": - self.longWait(300, 12) + self.longWait(5 * 60, 12) getInfo = create_getInfo(EuroshareEu) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index d9724ddb7..328095711 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -45,11 +45,9 @@ class ExtabitCom(SimpleHoster): m = re.search(r"Next free download from your ip will be available in (\d+)\s*minutes", self.html) if m: - self.setWait(int(m.group(1)) * 60, True) - self.wait() + self.wait(int(m.group(1)) * 60, True) elif "The daily downloads limit from your IP is exceeded" in self.html: - self.setWait(3600, True) - self.wait() + self.wait(1 * 60 * 60, True) self.logDebug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 97204a1a2..01119739b 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -63,8 +63,7 @@ class FilefactoryCom(SimpleHoster): waittime = re.search(r'id="startWait" value="(\d+)"', self.html) if not waittime: self.parseError('Unable to detect wait time') - self.setWait(int(waittime.group(1))) - self.wait() + self.wait(int(waittime.group(1))) # Parse the direct link and download it direct = re.search(r'data-href-direct="(.*)" class="button', self.html) diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index e18455255..191da7849 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -64,8 +64,7 @@ class FilepostCom(SimpleHoster): wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time')) if wait_time > 0: - self.setWait(wait_time) - self.wait() + self.wait(wait_time) post_dict = {"token": flp_token, "code": file_id, "file_pass": ''} diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index 8d0ff0a08..ceb5555ca 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -31,8 +31,7 @@ class FlyFilesNet(SimpleHoster): if parsed_url == '#downlink|' or parsed_url == "#downlink|#": self.logWarning("Could not get the download URL. Please wait 10 minutes.") - self.setWait(600, True) # wait 10 minutes - self.wait() + self.wait(10 * 60, True) self.retry() download_url = parsed_url.replace('#downlink|', '') diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index d1414347f..13848acc1 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -49,8 +49,7 @@ class FourSharedCom(SimpleHoster): except: pass - self.setWait(20) - self.wait() + self.wait(20) self.download(link) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 34539f965..1f892ca7c 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -100,8 +100,7 @@ class FshareVn(SimpleHoster): if found: self.logInfo("Wait until %s ICT" % found.group(1)) wait_until = mktime(strptime(found.group(1), "%d/%m/%Y %H:%M")) - self.setWait(wait_until - mktime(gmtime()) - 7 * 60 * 60, True) - self.wait() + self.wait(wait_until - mktime(gmtime()) - 7 * 60 * 60, True) self.retry() elif '
      ' in self.html: self.logError("Unknown error occured or wait time not parsed") diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index 1472fbb1d..c7dfb7984 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -68,8 +68,7 @@ class GigapetaCom(SimpleHoster): def checkErrors(self): if "All threads for IP" in self.html: self.logDebug("Your IP is already downloading a file - wait and retry") - self.setWait(300, True) - self.wait() + self.wait(5 * 60, True) self.retry() diff --git a/module/plugins/hoster/GooIm.py b/module/plugins/hoster/GooIm.py index f0051b082..a412821f2 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -41,8 +41,7 @@ class GooIm(SimpleHoster): m = re.search(r'MD5sum: (?P[0-9a-z]{32})', self.html) if m: self.check_data = {"md5": m.group('MD5')} - self.setWait(10) - self.wait() + self.wait(10) header = self.load(self.pyfile.url, just_header=True) if header['location']: diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 3a0290591..d128f427b 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -58,8 +58,7 @@ class IfolderRu(SimpleHoster): url = "http://ints.rusfolder.com/ints/frame/?session=%s" % session_id self.html = self.load(url, cookies=True) - self.setWait(31, False) - self.wait() + self.wait(31, False) captcha_url = "http://ints.rusfolder.com/random/images/?session=%s" % session_id for _ in xrange(5): diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index d2ef616a8..2475c31fe 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -97,8 +97,7 @@ class LetitbitNet(SimpleHoster): # ajax_check_url, captcha_url = re.search(self.CHECK_URL_PATTERN, self.html).groups() # found = re.search(self.SECONDS_PATTERN, self.html) # seconds = int(found.group(1)) if found else 60 - # self.setWait(seconds+1) - # self.wait() + # self.wait(seconds+1) # except Exception, e: # self.logError(e) # self.parseError("page 3 / js") @@ -109,8 +108,7 @@ class LetitbitNet(SimpleHoster): found = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) recaptcha_control_field = found.group(1) self.logDebug("ReCaptcha control field found", recaptcha_control_field) - self.setWait(seconds + 1) - self.wait() + self.wait(seconds + 1) response = self.load("%s/ajax/download3.php" % self.DOMAIN, post=" ", cookies=True) if response != '1': @@ -128,8 +126,7 @@ class LetitbitNet(SimpleHoster): self.invalidCaptcha() if response == "error_free_download_blocked": self.logInfo("Daily limit reached, waiting 24 hours") - self.setWait(24 * 60 * 60) - self.wait() + self.wait(24 * 60 * 60) if response == "error_wrong_captcha": self.logInfo("Wrong Captcha") self.invalidCaptcha() diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 271d166c0..1257656e7 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -43,8 +43,7 @@ class LuckyShareNet(SimpleHoster): self.logDebug('JSON: ' + rep) json = self.parseJson(rep) - self.setWait(int(json['time'])) - self.wait() + self.wait(int(json['time'])) recaptcha = ReCaptcha(self) for _ in xrange(5): diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index dda13e2da..8a62fed88 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.py @@ -57,8 +57,7 @@ class NowDownloadEu(SimpleHoster): baseurl = "http://www.nowdownload.ch" self.html = self.load(baseurl + str(tokenlink.group(1))) - self.setWait(wait) - self.wait() + self.wait(wait) self.html = self.load(baseurl + str(continuelink.group(1))) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 5b69db63d..e16793cf7 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -69,8 +69,7 @@ class OneFichierCom(SimpleHoster): self.waitAndRetry(int(self.lastcheck.group(1)) * 60) def waitAndRetry(self, wait_time): - self.setWait(wait_time, True) - self.wait() + self.wait(wait_time, True) self.retry() def setup(self): diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 5bed39712..7547d96a1 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -74,8 +74,7 @@ class TurbobitNet(SimpleHoster): found = re.search(self.LIMIT_WAIT_PATTERN, self.html) if found: wait_time = int(found.group(1)) - self.setWait(wait_time, wait_time > 60) - self.wait() + self.wait(wait_time, wait_time > 60) self.retry() action, inputs = self.parseHtmlForm("action='#'") diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 4e2db527a..71a341b76 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -158,8 +158,7 @@ class UlozTo(SimpleHoster): elif check == "server_error": self.logError("Server error, try downloading later") self.multiDL = False - self.setWait(3600, True) - self.wait() + self.wait(1 * 60 * 60, True) self.retry() elif check == "not_found": self.fail("Server error - file not downloadable") diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index c7deba89c..05921e13a 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -50,8 +50,7 @@ class UnibytesCom(SimpleHoster): break if '>Somebody else is already downloading using your IP-address<' in self.html: - self.setWait(600, True) - self.wait() + self.wait(10 * 60, True) self.retry() if post_data['step'] == 'last': @@ -68,8 +67,7 @@ class UnibytesCom(SimpleHoster): if last_step == 'timer': found = re.search(self.WAIT_PATTERN, self.html) - self.setWait(int(found.group(1)) if found else 60, False) - self.wait() + self.wait(int(found.group(1)) if found else 60, False) elif last_step in ('captcha', 'last'): post_data['captcha'] = self.decryptCaptcha(self.DOMAIN + '/captcha.jpg') else: diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 053705c05..1df6ca4fe 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -82,8 +82,7 @@ class UploadheroCom(SimpleHoster): found = re.search(self.IP_WAIT_PATTERN, self.html) wait_time = (int(found.group(1)) * 60 + int(found.group(2))) if found else 5 * 60 - self.setWait(wait_time, True) - self.wait() + self.wait(wait_time, True) self.retry() diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 230c67490..9bb526506 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -83,8 +83,7 @@ class UploadingCom(SimpleHoster): if 'answer' in response and 'wait_time' in response['answer']: wait_time = int(response['answer']['wait_time']) self.logInfo("%s: Waiting %d seconds." % (self.__name__, wait_time)) - self.setWait(wait_time) - self.wait() + self.wait(wait_time) else: self.pluginParseError("AJAX/WAIT") @@ -107,8 +106,7 @@ class UploadingCom(SimpleHoster): check = self.checkDownload({"html": re.compile("\A