From 746f877329bd8d62f58a3dbb2bdc5f2cd34c3d6a Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 17 Aug 2010 00:20:38 +0200 Subject: hotfile improvements --- module/plugins/Plugin.py | 2 +- module/plugins/hoster/HotfileCom.py | 29 +++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index f64a5defb..dfdfbe4f6 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -204,7 +204,6 @@ class Plugin(object): Ocr = self.core.pluginManager.getCaptchaPlugin(self.__name__) if Ocr and not forceUser: sleep(randint(3000, 5000) / 1000.0) - if self.pyfile.abort: raise Abort ocr = Ocr() @@ -220,6 +219,7 @@ class Plugin(object): task.removeTask() #temp.unlink(temp.name) self.fail(_("No Client connected for captcha decrypting.")) + if self.pyfile.abort: raise Abort sleep(1) result = task.getResult() task.removeTask() diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index 5f1a5901e..691b2b8c0 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -4,6 +4,7 @@ import re from time import time from module.plugins.Hoster import Hoster +from module.plugins.ReCaptcha import ReCaptcha class HotfileCom(Hoster): __name__ = "HotfileCom" @@ -28,7 +29,7 @@ class HotfileCom(Hoster): def process(self, pyfile): self.pyfile = pyfile self.prepare() - self.download( self.get_file_url() ) + self.get_file_url() def prepare(self): @@ -54,7 +55,7 @@ class HotfileCom(Hoster): def download_html(self): # if self.config['premium']: # self.req.add_auth(self.config['username'], self.config['password']) - self.html[0] = self.load(self.parent.url, get={"lang":"en"}, cookies=True) + self.html[0] = self.load(self.pyfile.url, get={"lang":"en"}, cookies=True) def get_file_url(self): # if self.config['premium']: @@ -65,10 +66,30 @@ class HotfileCom(Hoster): form_content = re.search(r"
\s*)*?\n", self.html[0]).group(0) form_posts = re.findall(r"", form_content) - self.html[1] = self.load(self.parent.url, post=form_posts, cookies=True) + self.html[1] = self.load(self.pyfile.url, post=form_posts, cookies=True) + + re_captcha = ReCaptcha(self) + + challenge = re.search(r"http://api.recaptcha.net/challenge\?k=([0-9A-Za-z]+)", self.html[1]) + + if challenge: + challenge, result = re_captcha.challenge(challenge.group(1)) + + url = re.search(r' (.+?) \|', self.html[0]).group(1) -- cgit v1.2.3