def recaptcha(self, pattern, page, extra_fields=None): #find catpcha and prompt captcha window #return source from addons.captcha.recaptcha import Recaptcha if self.is_running(): try: m = self.get_match(pattern, page) if m is not None: link = "http://www.google.com/recaptcha/api/challenge?k=%s" % m.group('key') for retry in range(3): c = Recaptcha(misc.get_host(self.link), link, self.wait_func) c.run_captcha() if c.solution is not None: page = self.recaptcha_post(pattern, page, c.captcha_challenge, c.solution, extra_fields) if self.recaptcha_success(pattern, page) or not self.is_running(): return page else: raise CaptchaException("No response from the user") raise CaptchaException("Captcha, max retries reached") else: return page except CaptchaException as err: self.err_msg = err logger.debug(err) return page
def recaptcha(self, pattern, page, extra_fields=None): #find catpcha and prompt captcha window #return source from addons.captcha.recaptcha import Recaptcha if self.is_running(): try: m = self.get_match(pattern, page) if m is not None: link = "http://www.google.com/recaptcha/api/challenge?k=%s" % m.group( 'key') for retry in range(3): c = Recaptcha(misc.get_host(self.link), link, self.wait_func) c.run_captcha() if c.solution is not None: m, page = self.recaptcha_post( pattern, page, c.captcha_challenge, c.solution, extra_fields) if not self.is_running() or m is None: return page else: raise CaptchaException("No response from the user") raise CaptchaException("Captcha, max retries reached") else: return page except CaptchaException as err: self.err_msg = err logger.debug(err) return page
def create_download_item(self, file_name, link, copy_link=True): """""" host = misc.get_host(link) if plugins_parser.services_dict.get(host, None) is None: host = cons.UNSUPPORTED download_item = DownloadItem(file_name, host, link, can_copy_link=copy_link) self.__pending_downloads[download_item.id] = download_item return download_item
def __init__(self, link): """""" threading.Thread.__init__(self) self.file_name = cons.UNKNOWN self.host = misc.get_host(link) self.link = link self.size = 0 self.link_status = cons.LINK_CHECKING self.status_msg = None
def create_download_item(self, file_name, size, link, copy_link=True): """""" host = misc.get_host(link) download_item = DownloadItem(file_name, host, size, link, can_copy_link=copy_link) self.__pending_downloads[download_item.id] = download_item return download_item