def handle_free(self, pyfile): data = {'ukey': self.info['pattern']['ID']} m = re.search(self.AB1_PATTERN, self.data) if m is None: self.error(_("__AB1")) data['__ab1'] = m.group(1) recaptcha = ReCaptcha(self) m = re.search(self.RECAPTCHA_PATTERN, self.data) captcha_key = m.group(1) if m else recaptcha.detect_key() if captcha_key is None: self.error(_("ReCaptcha key not found")) response, challenge = recaptcha.challenge(captcha_key) self.account.form_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response} self.account.relogin() self.retry(2) json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) self.log_debug(res) res = json.loads(res) if "error" in res and res['error']: self.fail(res) self.log_debug(res) if res['captcha']: data['ctype'] = "recaptcha" data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key) json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) self.log_debug(res) res = json.loads(res) if "retry" in res and res['retry']: self.retry_captcha() else: self.captcha.correct() if res['dl']: self.data = self.load('http://filecloud.io/download.html') m = re.search(self.LINK_FREE_PATTERN % self.info['pattern']['ID'], self.data) if m is None: self.error(_("LINK_FREE_PATTERN not found")) if "size" in self.info and self.info['size']: self.check_data = {'size': int(self.info['size'])} self.link = m.group(1) else: self.fail(_("Unexpected server response"))
def handle_free(self, pyfile): recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() if captcha_key: try: self.link = re.search(self.LINK_PREMIUM_PATTERN, self.data) recaptcha.challenge() except Exception, e: self.error(e)
def handle_free(self, pyfile): if "You need Premium membership to download this file." in self.data: self.fail(_("You need Premium membership to download this file")) for _i in xrange(5): m = re.search(self.CAPTCHA_PATTERN, self.data) if m is not None: url = urlparse.urljoin("http://crocko.com/", m.group(1)) self.wait(m.group(2)) self.data = self.load(url) else: break m = re.search(self.FORM_PATTERN, self.data, re.S) if m is None: self.error(_("FORM_PATTERN not found")) action, form = m.groups() inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) recaptcha = ReCaptcha(self) inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() self.download(action, post=inputs) if self.check_file({'captcha': recaptcha.KEY_AJAX_PATTERN}): self.retry_captcha()
def handle_free(self, pyfile): #: Click the "free user" button and wait a = self.load(pyfile.url, post={'downloadLink': "wait"}) self.log_debug(a) self.wait(30) #: Make the recaptcha appear and show it the pyload interface b = self.load(pyfile.url, post={'checkDownload': "check"}) self.log_debug(b) #: Expected output: {'success': "showCaptcha"} recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) #: Submit the captcha solution self.load("http://www.uploadable.ch/checkReCaptcha.php", post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : response, 'recaptcha_shortencode_field': self.info['pattern']['ID']}) self.wait(3) #: Get ready for downloading self.load(pyfile.url, post={'downloadLink': "show"}) self.wait(3) #: Download the file self.download(pyfile.url, post={'download': "normal"}, disposition=True)
def handle_free(self, pyfile): inputs = self.parse_html_form(input_names={'token': re.compile(r'.+')})[1] if 'token' not in inputs: self.error(_("Unable to detect token")) self.html = self.load(pyfile.url, post={'token': inputs['token']}) inputs = self.parse_html_form(input_names={'hash': re.compile(r'.+')})[1] if 'hash' not in inputs: self.error(_("Unable to detect hash")) recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() #@NOTE: Work-around for v0.4.9 just_header issue #@TODO: Check for v0.4.10 self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response, 'hash' : inputs['hash']}) self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) if 'location' in self.req.http.header.lower(): self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) self.captcha.correct() else: self.captcha.invalid()
def handle_captcha(self): solvemedia = SolveMedia(self.pyfile) captcha_key = solvemedia.detect_key() if captcha_key: self.captcha = solvemedia response, challenge = solvemedia.challenge(captcha_key) self.data = self.load("http://www.mediafire.com/?" + self.info['pattern']['ID'], post={'adcopy_challenge': challenge, 'adcopy_response' : response}) return recaptcha = ReCaptcha(self.pyfile) captcha_key = recaptcha.detect_key() if captcha_key: url, inputs = self.parse_html_form('name="form_captcha"') self.log_debug(("form_captcha url:%s inputs:%s") % (url, inputs)) if url: self.captcha = recaptcha response, challenge = recaptcha.challenge(captcha_key) inputs['g-recaptcha-response'] = response self.data = self.load(self.fixurl(url), post=inputs) else: self.fail("ReCaptcha form not found")
def handle_free(self, pyfile): rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID']) self.log_debug("JSON: " + rep) json = self.parse_json(rep) self.wait(json['time']) recaptcha = ReCaptcha(self) for _i in xrange(5): response, challenge = recaptcha.challenge() rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % (challenge, response, json['hash'])) self.log_debug("JSON: " + rep) if 'link' in rep: json.update(self.parse_json(rep)) self.captcha.correct() break elif 'Verification failed' in rep: self.captcha.invalid() else: self.error(_("Unable to get downlaod link")) if not json['link']: self.fail(_("No Download url retrieved/all captcha attempts failed")) self.link = json['link']
def handle_free(self, pyfile): self.html = self.load(pyfile.url, post={'gateway_result': "1"}) self.check_errors() m = re.search(r"var fid = '(\w+)';", self.html) if m is None: self.retry(wait_time=5) params = {'fid': m.group(1)} self.log_debug("FID: %s" % params['fid']) self.check_errors() recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() if captcha_key is None: return self.html = self.load("https://dfiles.eu/get_file.php", get=params) if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: params['response'], params['challenge'] = recaptcha.challenge(captcha_key) self.html = self.load("https://dfiles.eu/get_file.php", get=params) m = re.search(self.LINK_FREE_PATTERN, self.html) if m: self.link = urllib.unquote(m.group(1))
def handle_free(self, pyfile): #: Used here to load the cookies which will be required later self.load(pyfile.url, post={'goToFreePage': ""}) self.load("http://nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']}) self.data = self.load("http://nitroflare.com/ajax/freeDownload.php", post={'method': "startTimer", 'fileId': self.info['pattern']['ID']}) self.check_errors() try: js_file = self.load("http://nitroflare.com/js/downloadFree.js?v=1.0.1") var_time = re.search("var time = (\\d+);", js_file) wait_time = int(var_time.groups()[0]) except Exception: wait_time = 60 self.wait(wait_time) recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) self.data = self.load("http://nitroflare.com/ajax/freeDownload.php", post={'method' : "fetchDownload", 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) return super(NitroflareCom, self).handle_free(pyfile)
def handle_free(self, pyfile): self.req.http.lastURL = pyfile.url self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) jsvars = self.get_json_response("https://rapidu.net/ajax.php", get={'a': "getLoadTimeToDownload"}, post={'_go': ""}) if str(jsvars['timeToDownload']) == "stop": t = (24 * 60 * 60) - (int(time.time()) % (24 * 60 * 60)) + time.altzone self.log_info(_("You've reach your daily download transfer")) self.retry(10, 10 if t < 1 else None, _("Try tomorrow again")) #@NOTE: check t in case of not synchronised clock else: self.wait(int(jsvars['timeToDownload']) - int(time.time())) recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) jsvars = self.get_json_response("https://rapidu.net/ajax.php", get={'a': "getCheckCaptcha"}, post={'_go' : "", 'captcha1': challenge, 'captcha2': response, 'fileId' : self.info['pattern']['ID']}) if jsvars['message'] == "success": self.link = jsvars['url']
def handle_captcha(self): post_data = {'free' : 1, 'freeDownloadRequest': 1, 'uniqueId' : self.fid, 'yt0' : ''} m = re.search(r'id="(captcha\-form)"', self.html) self.log_debug("captcha-form found %s" % m) m = re.search(self.CAPTCHA_PATTERN, self.html) self.log_debug("CAPTCHA_PATTERN found %s" % m) if m: captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1)) post_data['CaptchaForm[code]'] = self.captcha.decrypt(captcha_url) else: recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) self.html = self.load(self.pyfile.url, post=post_data) if 'verification code is incorrect' not in self.html: self.captcha.correct() else: self.captcha.invalid()
def solve_captcha(self): recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) apiUrl = "http://www.oboom.com/1.0/download/ticket" params = { "recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "download_id": self.file_id, "token": self.session_token, } result = self.load_url(apiUrl, params) if result[0] == 200: self.download_token = result[1] self.download_auth = result[2] self.captcha.correct() self.wait(30) else: if result[0] == 403: if result[1] == -1: #: Another download is running self.set_wait(15 * 60) else: self.set_wait(result[1]) self.set_reconnect(True) self.wait() self.retry(5) elif result[0] == 400 and result[1] == "forbidden": self.retry(5, 15 * 60, _("Service unavailable")) self.retry_captcha()
def get_download_url(self): #: Return location if direct download is active if self.premium: header = self.load(self.pyfile.url, just_header=True) if 'location' in header: return header.get('location') #: Get download info self.log_debug("Getting download info") res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={'request': "generateID", 'ajaxid': self.ajaxid}) self.handle_errors(res, ':') parts = res.split(":") filetype = parts[0] wait = int(parts[1]) captcha = int(parts[2]) self.log_debug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha)) #: Waiting if wait > 0: self.log_debug("Waiting %d seconds." % wait) if wait < 120: self.wait(wait, False) else: self.wait(wait - 55, True) self.retry() #: Resolve captcha if captcha == 1: self.log_debug("File is captcha protected") recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={'request' : "validateCaptcha", 'ajaxid' : self.ajaxid, 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) self.handle_captcha_errors(res) #: Get download URL self.log_debug("Getting download url") res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={'request': "getDownloadURL", 'ajaxid': self.ajaxid}) self.handle_errors(res, '#') url = res.split("#")[-1] return url
def handle_free(self, pyfile): recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() self.data = self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) m = re.search(self.LINK_FREE_PATTERN, self.data) if m is not None: self.link = m.group(1)
def do_captcha(self): captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.data).group(1) recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(captcha_key) res = json.loads(self.load(self.URLS[2], post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : response, 'recaptcha_shortencode_field': self.file_id})) if res['success']: self.captcha.correct() else: self.retry_captcha()
def handle_free(self, pyfile): self.load("http://uploaded.net/language/en", just_header=True) self.html = self.load("http://uploaded.net/js/download.js") recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() self.html = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'], post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) super(UploadedTo, self).handle_free(pyfile) self.check_errors()
def handle_free(self, pyfile): self.load("http://uploaded.net/language/en", just_header=True) self.data = self.load("http://uploaded.net/js/download.js") recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() self.data = self.load( "http://uploaded.net/io/ticket/captcha/%s" % self.info["pattern"]["ID"], post={"recaptcha_challenge_field": challenge, "recaptcha_response_field": response}, ) self.check_errors() super(UploadedTo, self).handle_free(pyfile) self.check_errors()
def handle_captcha(self): recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) m = re.search(r'var wait=(\d+);', self.data) self.set_wait(int(m.group(1)) if m else 30) res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)), post={'dl_free' : "1", 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) if res != "0": self.captcha.correct() return res else: self.retry_captcha()
def handle_free(self, pyfile): if self.req.code == 404: self.offline() self.check_errors() m = re.search(self.LINK_FREE_PATTERN, self.data) if m: recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) self.download(m.group(1), post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, 'submit': "Submit", 'submitted': "1", 'd': "1"})
def do_captcha(self): captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1) recaptcha = ReCaptcha(self) for _i in xrange(5): response, challenge = recaptcha.challenge(captcha_key) res = json_loads(self.load(self.URLS[2], post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : response, 'recaptcha_shortencode_field': self.file_id})) if not res['success']: self.captcha.invalid() else: self.captcha.correct() break else: self.fail(_("Invalid captcha"))
class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" __version__ = "0.20" __status__ = "testing" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{15,16}' __config__ = [("activated" , "bool", "Activated" , True), ("use_premium" , "bool", "Use premium account if available" , True), ("fallback" , "bool", "Fallback to free download if premium fails" , True), ("chk_filesize", "bool", "Check file size" , True), ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """CatShare.net hoster plugin""" __license__ = "GPLv3" __authors__ = [("z00nx", "*****@*****.**"), ("prOq", None), ("Walter Purcaro", "*****@*****.**")] INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<' OFFLINE_PATTERN = r'<div class="alert alert-error"' IP_BLOCKED_PATTERN = ur'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<' WAIT_PATTERN = r'var\scount\s=\s(\d+);' LINK_FREE_PATTERN = r'<form action="(.+?)" method="GET">' LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">' def setup(self): self.multiDL = self.premium self.resume_download = True def handle_free(self, pyfile): self.captcha = ReCaptcha(pyfile) response, challenge = self.captcha.challenge() self.data = self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) m = re.search(self.LINK_FREE_PATTERN, self.data) if m is not None: self.link = m.group(1)
class FilerNet(SimpleHoster): __name__ = "FilerNet" __type__ = "hoster" __version__ = "0.24" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+' __config__ = [("activated" , "bool", "Activated" , True), ("use_premium" , "bool", "Use premium account if available" , True), ("fallback" , "bool", "Fallback to free download if premium fails" , True), ("chk_filesize", "bool", "Check file size" , True), ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Filer.net hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "*****@*****.**"), ("Walter Purcaro", "*****@*****.**")] INFO_PATTERN = r'<h1 class="page-header">Free Download (?P<N>\S+) <small>(?P<S>[\w.]+) (?P<U>[\w^_]+)</small></h1>' OFFLINE_PATTERN = r'Nicht gefunden' WAIT_PATTERN = r'var count = (\d+);' LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'href="([^"]+)">Get download</a>' def handle_free(self, pyfile): inputs = self.parse_html_form(input_names={'token': re.compile(r'.+')})[1] if 'token' not in inputs: self.error(_("Unable to detect token")) self.data = self.load(pyfile.url, post={'token': inputs['token']}) inputs = self.parse_html_form(input_names={'hash': re.compile(r'.+')})[1] if 'hash' not in inputs: self.error(_("Unable to detect hash")) self.captcha = ReCaptcha(pyfile) response, challenge = self.captcha.challenge() self.download(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response, 'hash' : inputs['hash']})
def handle_captcha(self): solvemedia = SolveMedia(self) captcha_key = solvemedia.detect_key() if captcha_key: response, challenge = solvemedia.challenge(captcha_key) self.html = self.load("http://www.mediafire.com/?" + self.info['pattern']['ID'], post={'adcopy_challenge': challenge, 'adcopy_response' : response}) return recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() if captcha_key: response, challenge = recaptcha.challenge(captcha_key) self.html = self.load(self.pyfile.url, post={'g-recaptcha-response': response})
def handle_free(self, pyfile): if r">Only premium users can download this file" in self.html: self.fail(_("Only premium users can download this file")) m = re.search(r"Next free download from your ip will be available in <b>(\d+)\s*minutes", self.html) if m: self.wait(int(m.group(1)) * 60, True) elif "The daily downloads limit from your IP is exceeded" in self.html: self.log_warning(_("You have reached your daily downloads limit for today")) self.wait(seconds_to_midnight(gmt=2), True) self.log_debug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) fileID = m.group('ID') if m else self.info['pattern']['ID'] m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html) if m: recaptcha = ReCaptcha(self) captcha_key = m.group(1) for _i in xrange(5): get_data = {'type': "recaptcha"} get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key) res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) if "ok" in res: self.captcha.correct() break else: self.captcha.invalid() else: self.fail(_("Invalid captcha")) else: self.error(_("Captcha")) if not "href" in res: self.error(_("Bad JSON response")) self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href'])) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("LINK_FREE_PATTERN not found")) self.link = m.group(1)
def get_download_options(self): re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", self.data).group(0) #: Get the whole request to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope) request_options = dict((n, v) for (v, n) in to_sort) herewego = self.load(self.pyfile.url, None, request_options) #: The actual download-Page to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego) request_options = dict((n, v) for (v, n) in to_sort) challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=(\w+)", herewego) if challenge: re_captcha = ReCaptcha(self) (request_options['recaptcha_challenge_field'], request_options['recaptcha_response_field']) = re_captcha.challenge(challenge.group(1)) return request_options
def unlock_protection(self): postData = {} form = re.search(r'<form name="protected"(.*?)</form>', self.cleaned_html, re.S).group(1) #: Submit package password if "password" in form: password = self.get_password() self.log_debug("Submitting password [%s] for protected links" % password) postData['password'] = password #: Resolve anicaptcha if "anicaptcha" in form: self.log_debug("Captcha protected") captchaUri = re.search(r'src="(/temp/anicaptcha/.+?)"', form).group(1) captcha = self.captcha.decrypt("http://ncrypt.in" + captchaUri) self.log_debug("Captcha resolved [%s]" % captcha) postData['captcha'] = captcha #: Resolve recaptcha if "recaptcha" in form: self.log_debug("ReCaptcha protected") captcha_key = re.search(r'\?k=(.*?)"', form).group(1) self.log_debug("Resolving ReCaptcha with key [%s]" % captcha_key) recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(captcha_key) postData['recaptcha_challenge_field'] = challenge postData['recaptcha_response_field'] = response #: Resolve circlecaptcha if "circlecaptcha" in form: self.log_debug("CircleCaptcha protected") captcha_img_url = "http://ncrypt.in/classes/captcha/circlecaptcha.php" coords = self.captcha.decrypt(captcha_img_url, input_type="png", output_type='positional', ocr="CircleCaptcha") self.log_debug("Captcha resolved, coords %s" % coords) postData['circle.x'] = coords[0] postData['circle.y'] = coords[1] #: Unlock protection postData['submit_protected'] = 'Continue to folder' return self.load(self.pyfile.url, post=postData)
def handle_free(self, pyfile): #: STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: self.error(_("CHASH_PATTERN not found")) chash = m.group(1) self.log_debug("Read hash " + chash) #: Continue to stage2 post_data = {'hash': chash, 'free': 'Slow download'} self.html = self.load(pyfile.url, post=post_data) #: STAGE 2: solv captcha and wait #: First get the infos we need: recaptcha key and wait time recaptcha = ReCaptcha(self) #: Try the captcha 5 times for i in xrange(5): m = re.search(self.WAIT_PATTERN, self.html) if m is None: self.error(_("Wait pattern not found")) wait_time = int(m.group(1)) #: then, do the waiting self.wait(wait_time) #: then, handle the captcha response, challenge = recaptcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) self.html = self.load(pyfile.url, post=post_data) #: STAGE 3: get direct link m = re.search(self.LINK_FREE_PATTERN, self.html, re.S) if m: break if m is None: self.error(_("Download link not found")) self.link = m.group(1)
def handle_captcha(self): recaptcha = ReCaptcha(self) for _i in xrange(5): response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) m = re.search(r'var wait=(\d+);', self.html) self.set_wait(int(m.group(1)) if m else 30) res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)), post={'dl_free' : "1", 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) if not res == "0": self.captcha.correct() return res else: self.captcha.invalid() else: self.captcha.invalid() self.fail(_("No valid captcha solution received"))
def solve_captcha(self): recaptcha = ReCaptcha(self) for _i in xrange(5): response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) apiUrl = "http://www.oboom.com/1.0/download/ticket" params = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, 'download_id': self.file_id, 'token': self.session_token} result = self.load_url(apiUrl, params) if result[0] == 200: self.download_token = result[1] self.download_auth = result[2] self.captcha.correct() self.wait(30) break elif result[0] == 400: if result[1] == "incorrect-captcha-sol": self.captcha.invalid() elif result[1] == "captcha-timeout": self.captcha.invalid() elif result[1] == "forbidden": self.retry(5, 15 * 60, _("Service unavailable")) elif result[0] == 403: if result[1] == -1: #: Another download is running self.set_wait(15 * 60) else: self.set_wait(result[1], True) self.wait() self.retry(5) else: self.captcha.invalid() self.fail(_("Received invalid captcha 5 times"))
def handle_free(self, pyfile): rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID']) self.log_debug("JSON: " + rep) jso = self.parse_json(rep) self.wait(jso['time']) recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % (challenge, response, jso['hash'])) self.log_debug("JSON: " + rep) if 'Verification failed' in rep: self.retry_captcha() elif 'link' in rep: self.captcha.correct() jso.update(self.parse_json(rep)) if jso['link']: self.link = jso['link']