.*?)\s*'
SIZE_PATTERN = r'\s*Size\s* | \s*\s*(?P.*?)\s* | '
OFFLINE_PATTERN = r''
DOWNLOAD_PATTERN = r'"All threads for IP'
COOKIES = [("gigapeta.com", "lang", "us")]
def handle_free(self, pyfile):
captcha_key = str(random.randint(1, 100000000))
captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key
self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
for _i in xrange(5):
self.check_errors()
captcha = self.decrypt_captcha(captcha_url)
self.html = self.load(pyfile.url, post={
"captcha_key": captcha_key,
"captcha": captcha,
"download": "Download"})
m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I)
if m:
self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10
break
elif "Entered figures don`t coincide with the picture" in self.html:
self.invalid_captcha()
else:
self.fail(_("No valid captcha code entered"))
self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)
getInfo = create_getInfo(GigapetaCom)