.*?)\s*'
FILE_SIZE_PATTERN = r'\s*Size\s* | \s*\s*(?P.*?)\s* | '
FILE_OFFLINE_PATTERN = r''
def handleFree(self):
captcha_key = str(randint(1,100000000))
captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key
self.req.http.c.setopt(FOLLOWLOCATION, 0)
for i in range(5):
self.checkErrors()
captcha = self.decryptCaptcha(captcha_url)
self.html = self.load(self.pyfile.url, post = {
"captcha_key": captcha_key,
"captcha": captcha,
"download": "Download"})
found = re.search(r"Location\s*:\s*(.*)", self.req.http.header, re.I)
if found:
download_url = found.group(1)
break
elif "Entered figures don`t coincide with the picture" in self.html:
self.invalidCaptcha()
else:
self.fail("No valid captcha code entered")
self.req.http.c.setopt(FOLLOWLOCATION, 1)
self.logDebug("Download URL: %s" % download_url)
self.download(download_url)
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.retry()
getInfo = create_getInfo(GigapetaCom)