diff options
Diffstat (limited to 'module/plugins/crypter/LinkdecrypterCom.py')
-rw-r--r-- | module/plugins/crypter/LinkdecrypterCom.py | 65 |
1 files changed, 21 insertions, 44 deletions
diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index 91318eadf..0704214d0 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -1,19 +1,20 @@ # -*- coding: utf-8 -*- import re + from module.plugins.Crypter import Crypter class LinkdecrypterCom(Crypter): __name__ = "LinkdecrypterCom" __type__ = "crypter" - __version__ = "0.27" + __version__ = "0.29" __pattern__ = r'^unmatchable$' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] - __description__ = """Linkdecrypter.com""" + __description__ = """Linkdecrypter.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), ("flowlee", None)] @@ -21,46 +22,25 @@ class LinkdecrypterCom(Crypter): TEXTAREA_PATTERN = r'<textarea name="links" wrap="off" readonly="1" class="caja_des">(.+)</textarea>' PASSWORD_PATTERN = r'<input type="text" name="password"' - CAPTCHA_PATTERN = r'<img class="captcha" src="(.+?)"(.*?)>' - REDIR_PATTERN = r'<i>(Click <a href="./">here</a> if your browser does not redirect you).</i>' - - - def decrypt(self, pyfile): - self.passwords = self.getPassword().splitlines() - - # API not working anymore - self.urls = self.decryptHTML() + CAPTCHA_PATTERN = r'<img class="captcha" src="(.+?)"(.*?)>' + REDIR_PATTERN = r'<i>(Click <a href="./">here</a> if your browser does not redirect you).</i>' - def decryptAPI(self): - get_dict = {"t": "link", "url": self.pyfile.url, "lcache": "1"} - self.html = self.load('http://linkdecrypter.com/api', get=get_dict) - if self.html.startswith('http://'): - return self.html.splitlines() + def setup(self): + self.password = self.getPassword() + self.req.setOption("timeout", 300) - if self.html == 'INTERRUPTION(PASSWORD)': - for get_dict['pass'] in self.passwords: - self.html = self.load('http://linkdecrypter.com/api', get=get_dict) - if self.html.startswith('http://'): - return self.html.splitlines() - self.logError("API", self.html) - if self.html == 'INTERRUPTION(PASSWORD)': - self.fail(_("No or incorrect password")) - - return None - - - def decryptHTML(self): + def decrypt(self, pyfile): retries = 5 - post_dict = {"link_cache": "on", "pro_links": self.pyfile.url, "modo_links": "text"} - self.html = self.load('http://linkdecrypter.com/', post=post_dict, cookies=True, decode=True) + post_dict = {"link_cache": "on", "pro_links": pyfile.url, "modo_links": "text"} + self.html = self.load('http://linkdecrypter.com/', post=post_dict, decode=True) - while self.passwords or retries: - m = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.S) + while retries: + m = re.search(self.TEXTAREA_PATTERN, self.html, re.S) if m: - return [x for x in m.group(1).splitlines() if '[LINK-ERROR]' not in x] + self.urls = [x for x in m.group(1).splitlines() if '[LINK-ERROR]' not in x] m = re.search(self.CAPTCHA_PATTERN, self.html) if m: @@ -78,15 +58,12 @@ class LinkdecrypterCom(Crypter): retries -= 1 elif self.PASSWORD_PATTERN in self.html: - if self.passwords: - password = self.passwords.pop(0) - self.logInfo(_("Password protected link, trying ") + password) - self.html = self.load('http://linkdecrypter.com/', post={'password': password}, decode=True) + if self.password: + self.logInfo(_("Password protected link")) + self.html = self.load('http://linkdecrypter.com/', post={'password': self.password}, decode=True) else: - self.fail(_("No or incorrect password")) + self.fail(_("Missing password")) else: retries -= 1 - self.html = self.load('http://linkdecrypter.com/', cookies=True, decode=True) - - return None + self.html = self.load('http://linkdecrypter.com/', decode=True) |