diff options
Diffstat (limited to 'pyload/plugins/hoster/FilepostCom.py')
-rw-r--r-- | pyload/plugins/hoster/FilepostCom.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/pyload/plugins/hoster/FilepostCom.py b/pyload/plugins/hoster/FilepostCom.py index 41674ebc8..97fdd6c67 100644 --- a/pyload/plugins/hoster/FilepostCom.py +++ b/pyload/plugins/hoster/FilepostCom.py @@ -10,22 +10,23 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): - __name__ = "FilepostCom" - __type__ = "hoster" - __version__ = "0.28" + __name__ = "FilepostCom" + __type__ = "hoster" + __version__ = "0.29" - __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*' + __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/([^/]+).*' __description__ = """Filepost.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - 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"/>' + INFO_PATTERN = r'<input type="text" id="url" value=\'<a href[^>]*>(?P<N>[^>]+?) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)</a>\' class="inp_text"/>' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>|<div class="file_info file_info_deleted">' PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' - RECAPTCHA_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" - FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'" + RECAPTCHA_PATTERN = r'Captcha.init\({\s*key:\s*\'(.+?)\'' + FLP_TOKEN_PATTERN = r'set_store_options\({token: \'(.+?)\'' def handleFree(self): @@ -34,12 +35,12 @@ class FilepostCom(SimpleHoster): m = re.search(self.FLP_TOKEN_PATTERN, self.html) if m is None: - self.parseError("Token") + self.error(_("Token")) flp_token = m.group(1) m = re.search(self.RECAPTCHA_PATTERN, self.html) if m is None: - self.parseError("Captcha key") + self.error(_("Captcha key")) captcha_key = m.group(1) # Get wait time @@ -57,14 +58,14 @@ class FilepostCom(SimpleHoster): 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) + 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") + self.fail(_("No or incorrect password")) else: # Solve recaptcha @@ -87,17 +88,18 @@ class FilepostCom(SimpleHoster): self.invalidCaptcha() else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) # Download 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) + self.error(_("JSON %s 1") % field) # i changed js_answer to json_response['js'] since js_answer is nowhere set. # i don't know the JSON-HTTP specs in detail, but the previous author @@ -118,10 +120,9 @@ class FilepostCom(SimpleHoster): return None else: self.fail(json_response['js']['error']) - # ~? 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) + self.error(_("JSON %s 2") % field) return json_response['js']['answer'][field] |