diff options
author | Jeix <devnull@localhost> | 2010-08-04 18:35:54 +0200 |
---|---|---|
committer | Jeix <devnull@localhost> | 2010-08-04 18:35:54 +0200 |
commit | 91939fb1a8c1bca5a99fabc797eee839f59fb88c (patch) | |
tree | 7f5d05a78613e62b6ee0c08b3eac891ee124e46d | |
parent | better output formatting, somefixes (diff) | |
download | pyload-91939fb1a8c1bca5a99fabc797eee839f59fb88c.tar.xz |
netload, ocr
-rw-r--r-- | module/plugins/Plugin.py | 3 | ||||
-rw-r--r-- | module/plugins/hoster/NetloadIn.py | 23 |
2 files changed, 19 insertions, 7 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 19b5983a6..29fdebde8 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -24,6 +24,8 @@ from os.path import join from time import time from time import sleep +from random import randint + import sys from os.path import exists @@ -185,6 +187,7 @@ class Plugin(object): Ocr = self.core.pluginManager.getCaptchaPlugin(self.__name__) if Ocr: + sleep(randint(3000, 5000) / 1000.0) ocr = Ocr() result = ocr.get_captcha(temp.name) else: diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 9d3b0d387..9edc2d254 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -39,14 +39,20 @@ class NetloadIn(Hoster): # self.log.info("Netload: Use Premium Account") # return True - self.download_html() + for i in range(5): + if not self.download_html(): + self.setWait(5) + self.log.info(_("Netload: waiting %d minutes, because the file is currently not available." % self.get_wait_time())) + self.wait() + continue - self.setWait(self.get_wait_time()) - self.log.debug(_("Netload: waiting %d seconds" % self.get_wait_time())) - self.wait() - - self.url = self.get_file_url() - return True + wait_time = self.get_wait_time() + self.setWait(wait_time) + self.log.debug(_("Netload: waiting %d seconds" % wait_time)) + self.wait() + + self.url = self.get_file_url() + return True else: self.offline() @@ -89,6 +95,9 @@ class NetloadIn(Hoster): for i in range(6): self.html[1] = self.load(url_captcha_html, cookies=True) + if "Please retry again in a few minutes" in self.html[1]: + return False + try: captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', self.html[1]).group(1) except: |