diff options
| -rw-r--r-- | module/plugins/hoster/UptoboxCom.py | 41 | 
1 files changed, 40 insertions, 1 deletions
diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index b4b35ab20..e403425c1 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -16,14 +16,19 @@  #  @author: Walter Purcaro  ############################################################################### +import re +from urllib import unquote +  from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo +from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia +from module.utils import html_unescape  class UptoboxCom(XFileSharingPro):      __name__ = "UptoboxCom"      __type__ = "hoster"      __pattern__ = r'https?://(?:www\.)?uptobox\.com/\w+' -    __version__ = "0.08" +    __version__ = "0.09"      __description__ = """Uptobox.com hoster plugin"""      __author_name__ = "Walter Purcaro"      __author_mail__ = "vuolter@gmail.com" @@ -38,5 +43,39 @@ class UptoboxCom(XFileSharingPro):      DIRECT_LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"' +    def handleCaptcha(self, inputs): +        found = re.search(self.SOLVEMEDIA_PATTERN, self.html) +        if found: +            captcha_key = found.group(1) +            captcha = SolveMedia(self) +            inputs['adcopy_challenge'], inputs['adcopy_response'] = captcha.challenge(captcha_key) +            return 4 +        else: +            found = re.search(self.CAPTCHA_URL_PATTERN, self.html) +            if found: +                captcha_url = found.group(1) +                inputs['code'] = self.decryptCaptcha(captcha_url) +                return 2 +            else: +                found = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL) +                if found: +                    captcha_div = found.group(1) +                    self.logDebug(captcha_div) +                    numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', +                                          html_unescape(captcha_div)) +                    inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))]) +                    self.logDebug("CAPTCHA", inputs['code'], numerals) +                    return 3 +                else: +                    found = re.search(self.RECAPTCHA_URL_PATTERN, self.html) +                    if found: +                        recaptcha_key = unquote(found.group(1)) +                        self.logDebug("RECAPTCHA KEY: %s" % recaptcha_key) +                        recaptcha = ReCaptcha(self) +                        inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge( +                            recaptcha_key) +                        return 1 +        return 0 +  getInfo = create_getInfo(UptoboxCom)  | 
