diff options
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/hoster/FilepostCom.py | 105 | ||||
| -rw-r--r-- | module/plugins/hoster/MediafireCom.py | 11 | 
2 files changed, 74 insertions, 42 deletions
| diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 42ec0788b..d12fad738 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -18,7 +18,6 @@  import re  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.network.RequestFactory import getURL  from module.plugins.ReCaptcha import ReCaptcha  from module.common.json_layer import json_loads  from time import time @@ -26,16 +25,17 @@ from time import time  class FilepostCom(SimpleHoster):      __name__ = "FilepostCom"      __type__ = "hoster" -    __pattern__ = r"https?://(?:www\.)?filepost\.com/files/([^/]+).*" -    __version__ = "0.23" +    __pattern__ = r"https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*" +    __version__ = "0.25"      __description__ = """Filepost.com plugin - free only"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") -    FILE_INFO_PATTERN = r'<h1>(?P<N>[^<]+)</h1>\s*<div class="ul">\s*<ul>\s*<li><span>Size:</span> (?P<S>[0-9.]+) (?P<U>[kKMG])i?B</li>' +    FILE_INFO_PATTERN = r'<input type="text" id="url" value=\'<a href[^>]*>(?P<N>[^>]+?) - (?P<S>[0-9\.]+ [kKMG]i?B)</a>\' class="inp_text"/>' +    #FILE_INFO_PATTERN = r'<h1>(?P<N>[^<]+)</h1>\s*<div class="ul">\s*<ul>\s*<li><span>Size:</span> (?P<S>[0-9.]+) (?P<U>[kKMG])i?B</li>'      FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>'      RECAPTCHA_KEY_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" -    FLP_TOKEN_PATTERN = r"store.set\('(?:flp_)?token', '([^']+)'\);" +    FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'"      def handleFree(self):          # Find token and captcha key @@ -49,42 +49,71 @@ class FilepostCom(SimpleHoster):          if not found: self.parseError("Captcha key")          captcha_key = found.group(1) -        url = 'https://filepost.com/files/get/' -          # Get wait time          get_dict = {'SID' : self.req.cj.getCookie('SID'), 'JsHttpRequest' : str(int(time()*10000)) + '-xml'} -        post_dict = {'action' : 'set_download', 'download' : flp_token, 'code' : file_id} -        json_response = json_loads(self.load(url, get = get_dict, post = post_dict)) -        self.logDebug(json_response) -        try: -            self.setWait(int(json_response['js']['answer']['wait_time'])) -        except Exception, e: -            self.logError(e) -            self.self.parseError("Wait time") -        self.wait() - -        # Solve recaptcha -        recaptcha = ReCaptcha(self) -        for i in range(5): -            captcha_challenge, captcha_response = recaptcha.challenge(captcha_key) -            self.logDebug("RECAPTCHA: %s : %s : %s" % (captcha_key, captcha_challenge, captcha_response)) - -            get_dict['JsHttpRequest'] = str(int(time()*10000)) + '-xml' -            post_dict = {'download' : flp_token, 'code' : file_id, -                "recaptcha_challenge_field" : captcha_challenge, -                "recaptcha_response_field" : captcha_response -                } - -            json_response = json_loads(self.load(url, get = get_dict, post = post_dict)) -            try: -                download_url = json_response['js']['answer']['link'] -                self.correctCaptcha() -                break -            except: -                self.invalidCaptcha() -        else: self.fail("Invalid captcha") +        post_dict = {'action' : 'set_download', 'token' : flp_token, 'code' : file_id}                     +        wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time'))      +        if wait_time > 0: +            self.setWait(wait_time) +            self.wait()                                +         +        post_dict = {"token" : flp_token, "code" : file_id, "file_pass" : ''} +         +        if 'var is_pass_exists = true;' in self.html: +            # Solve password             +            for file_pass in self.getPassword().splitlines(): +                get_dict['JsHttpRequest'] = str(int(time()*10000)) + '-xml'            +                post_dict['file_pass'] = file_pass +                self.logInfo("Password protected link, trying " + file_pass)                 +                                     +                download_url = self.getJsonResponse(get_dict, post_dict, 'link')                +                if download_url:  +                    break +                       +            else: self.fail("No or incorrect password")          +         +        else: +            # Solve recaptcha +            recaptcha = ReCaptcha(self) +             +            for pokus in range(5): +                get_dict['JsHttpRequest'] = str(int(time()*10000)) + '-xml' +                if pokus: +                    post_dict["recaptcha_challenge_field"], post_dict["captcha_response_field"] = recaptcha.challenge(captcha_key) +                    self.logDebug(u"RECAPTCHA: %s : %s : %s" % (captcha_key, post_dict["recaptcha_challenge_field"], post_dict["captcha_response_field"]))                 +                  +                download_url = self.getJsonResponse(get_dict, post_dict, 'link') +                if download_url: +                    if pokus: self.correctCaptcha() +                    break +                elif pokus: +                    self.invalidCaptcha() +                                 +            else: self.fail("Invalid captcha") +                  # Download -        self.download(download_url) +        self.download(download_url)        +     +    def getJsonResponse(self, get_dict, post_dict, field):      +        json_response = json_loads(self.load('https://filepost.com/files/get/', get = get_dict, post = post_dict)) +        self.logDebug(json_response) +         +        if not 'js' in json_response: self.parseError('JSON %s 1' % field)        +         +        if 'error' in json_response['js']: +            if json_response['js']['error'] == 'download_delay': +                self.retry(js_answer['params']['next_download']) +            elif 'Wrong file password' in json_response['js']['error']: +                return None  +            elif 'You entered a wrong CAPTCHA code' in json_response['js']['error']: +                return None   +            else: +                self.fail(js_answer['error']) +         +        if not 'answer' in json_response['js'] or not field in json_response['js']['answer']:  +            self.parseError('JSON %s 2' % field) +             +        return json_response['js']['answer'][field]  getInfo = create_getInfo(FilepostCom)
\ No newline at end of file diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index f970512ab..f40071478 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -58,7 +58,7 @@ class MediafireCom(SimpleHoster):      __name__ = "MediafireCom"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)*mediafire\.com/[^?].*" -    __version__ = "0.72" +    __version__ = "0.73"      __description__ = """Mediafire.com plugin - free only"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -68,11 +68,14 @@ class MediafireCom(SimpleHoster):      JS_ZMODULO_PATTERN = r"\('z-index'\)\) \% (\d+)\)\);"       RECAPTCHA_PATTERN = r'src="http://(?:api.recaptcha.net|www.google.com/recaptcha/api)/challenge\?k=([^"]+)">'      PAGE1_ACTION_PATTERN = r'<link rel="canonical" href="([^"]+)"/>' -    PASSWORD_PATTERN = r";break;}\s*dh\('" +    PASSWORD_PATTERN = r'<form name="form_password"'      FILE_NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>'      FILE_SIZE_PATTERN = r'>Download\s*<span>\((?P<S>[^)]+)\)</span>'      FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>' +     +    def setup(self): +        self.multiDL = True      def process(self, pyfile):          self.url, result = checkHTMLHeader(pyfile.url) @@ -92,8 +95,8 @@ class MediafireCom(SimpleHoster):              self.download(self.url, disposition = True)      def handleFree(self): -        passwords = self.getPassword().split() -        while re.search(self.PASSWORD_PATTERN, self.html): +        passwords = self.getPassword().splitlines() +        while self.PASSWORD_PATTERN in self.html:              if len(passwords):                  password = passwords.pop(0)                  self.logInfo("Password protected link, trying " + password) | 
