From c8532b09917647b656d650e0b4a82de6022d85a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 3 Nov 2014 12:05:36 +0100 Subject: [XFSHoster] Fix handleOverriden --- module/plugins/internal/XFSHoster.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index b7a407a19..838af9102 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -2,9 +2,10 @@ import re -from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME from random import random +from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME + from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia from module.plugins.internal.SimpleHoster import create_getInfo, replace_patterns, set_cookies, SimpleHoster from module.plugins.Plugin import Fail @@ -14,7 +15,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = None @@ -71,6 +72,12 @@ class XFSHoster(SimpleHoster): self.errmsg = None self.passwords = self.getPassword().splitlines() + if re.match(self.__pattern__, self.pyfile.url) is None: + if self.premium: + self.handleOverriden() + else: + self.fail(_("Only premium users can download from other hosters")) + return super(XFSHoster, self).prepare() @@ -118,26 +125,31 @@ class XFSHoster(SimpleHoster): return m.group(1) - #@TODO: Re-enable def handleOverriden(self): #only tested with easybytez.com - self.html = self.load("http://www.%s/" % self.HOSTER_NAME) + self.html = self.load("http://www.%s/" % self.HOSTER_DOMAIN) + action, inputs = self.parseHtmlForm('') + upload_id = "%012d" % int(random() * 10 ** 12) action += upload_id + "&js_on=1&utype=prem&upload_type=url" + inputs['tos'] = '1' inputs['url_mass'] = self.pyfile.url inputs['up1oad_type'] = 'url' self.logDebug(action, inputs) - #wait for file to upload to easybytez.com - self.req.http.c.setopt(LOW_SPEED_TIME, 600) + + self.req.http.c.setopt(LOW_SPEED_TIME, 600) #: wait for file to upload to easybytez.com + self.html = self.load(action, post=inputs) action, inputs = self.parseHtmlForm('F1') if not inputs: - self.error(_("TEXTAREA not found")) + self.error(_("TEXTAREA F1 not found")) + self.logDebug(inputs) + if inputs['st'] == 'OK': self.html = self.load(action, post=inputs) elif inputs['st'] == 'Can not leech file': @@ -212,7 +224,7 @@ class XFSHoster(SimpleHoster): if self.errmsg: self.retry(reason=self.errmsg) else: - self.error(_("Form not found")) + self.error(_("TEXTAREA F1 not found")) self.logDebug(inputs) -- cgit v1.2.3