From 29079852619040ef862554ec261b03b34cbed852 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 8 Jan 2015 23:34:54 +0100 Subject: "New Year" Update: crypter plugins --- module/plugins/crypter/FourChanOrg.py | 27 ---------------- module/plugins/crypter/LinkdecrypterCom.py | 33 ++------------------ module/plugins/crypter/OneKhDe.py | 41 ------------------------- module/plugins/crypter/SafelinkingNet.py | 4 ++- module/plugins/crypter/XFileSharingProFolder.py | 15 ++++++--- module/plugins/crypter/_1KhDe.py | 41 +++++++++++++++++++++++++ module/plugins/crypter/_4ChanOrg.py | 27 ++++++++++++++++ 7 files changed, 84 insertions(+), 104 deletions(-) delete mode 100644 module/plugins/crypter/FourChanOrg.py delete mode 100644 module/plugins/crypter/OneKhDe.py create mode 100644 module/plugins/crypter/_1KhDe.py create mode 100644 module/plugins/crypter/_4ChanOrg.py (limited to 'module') diff --git a/module/plugins/crypter/FourChanOrg.py b/module/plugins/crypter/FourChanOrg.py deleted file mode 100644 index d6c5c86cc..000000000 --- a/module/plugins/crypter/FourChanOrg.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Based on 4chandl by Roland Beermann (https://gist.github.com/enkore/3492599) - -import re - -from module.plugins.Crypter import Crypter - - -class FourChanOrg(Crypter): - __name__ = "FourChanOrg" - __type__ = "crypter" - __version__ = "0.30" - - __pattern__ = r'http://(?:www\.)?boards\.4chan\.org/\w+/res/(\d+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """4chan.org folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [] - - - def decrypt(self, pyfile): - pagehtml = self.load(pyfile.url) - images = set(re.findall(r'(images\.4chan\.org/[^/]*/src/[^"<]*)', pagehtml)) - self.urls = ["http://" + image for image in images] diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index 7eb5d3096..7f24784c7 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -7,7 +7,7 @@ from module.plugins.Crypter import Crypter class LinkdecrypterCom(Crypter): __name__ = "LinkdecrypterCom" __type__ = "crypter" - __version__ = "0.28" + __version__ = "0.29" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -31,40 +31,15 @@ class LinkdecrypterCom(Crypter): def decrypt(self, pyfile): - # API not working anymore - self.urls = self.decryptHTML() - - - 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() - - if self.html == 'INTERRUPTION(PASSWORD)': - get_dict['pass'] = self.password - - 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): retries = 5 - post_dict = {"link_cache": "on", "pro_links": self.pyfile.url, "modo_links": "text"} + post_dict = {"link_cache": "on", "pro_links": pyfile.url, "modo_links": "text"} self.html = self.load('http://linkdecrypter.com/', post=post_dict, cookies=True, decode=True) while retries: m = re.search(self.TEXTAREA_PATTERN, self.html, flags=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: @@ -91,5 +66,3 @@ class LinkdecrypterCom(Crypter): else: retries -= 1 self.html = self.load('http://linkdecrypter.com/', cookies=True, decode=True) - - return None diff --git a/module/plugins/crypter/OneKhDe.py b/module/plugins/crypter/OneKhDe.py deleted file mode 100644 index cfb084da8..000000000 --- a/module/plugins/crypter/OneKhDe.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.unescape import unescape -from module.plugins.Crypter import Crypter - - -class OneKhDe(Crypter): - __name__ = "OneKhDe" - __type__ = "crypter" - __version__ = "0.10" - - __pattern__ = r'http://(?:www\.)?1kh\.de/f/' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """1kh.de decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("spoob", "spoob@pyload.org")] - - - def __init__(self, parent): - Crypter.__init__(self, parent) - self.parent = parent - - - def file_exists(self): - """ returns True or False - """ - return True - - - def proceed(self, url, location): - url = self.parent.url - self.html = self.load(url) - link_ids = re.findall(r"", self.load("http://1kh.de/l/" + id)).group(1)) - self.urls.append(new_link) diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index 709083b51..a56a0a44c 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -14,7 +14,7 @@ from module.plugins.internal.CaptchaService import SolveMedia class SafelinkingNet(Crypter): __name__ = "SafelinkingNet" __type__ = "crypter" - __version__ = "0.11" + __version__ = "0.13" __pattern__ = r'https?://(?:www\.)?safelinking\.net/([pd])/\w+' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -42,6 +42,8 @@ class SafelinkingNet(Crypter): else: postData = {"post-protect": "1"} + self.html = self.load(url) + if "link-password" in self.html: postData['link-password'] = self.getPassword() diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py index 10e4d8c83..5ad9f7678 100644 --- a/module/plugins/crypter/XFileSharingProFolder.py +++ b/module/plugins/crypter/XFileSharingProFolder.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo class XFileSharingProFolder(XFSCrypter): __name__ = "XFileSharingProFolder" __type__ = "crypter" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -30,21 +30,26 @@ class XFileSharingProFolder(XFSCrypter): self.__pattern__ = self.core.pluginManager.crypterPlugins[self.__name__]['pattern'] - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group(1).lower() - self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')]) + self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.HOSTER_NAME = "".join([part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.']) + + if self.HOSTER_NAME[0].isdigit(): + self.HOSTER_NAME = '_' + self.HOSTER_NAME account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) if account and account.canUse(): self.account = account + elif self.account: self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + else: return self.user, data = self.account.selectAccount() - self.req = self.account.getAccountRequest(self.user) - self.premium = self.account.isPremium(self.user) + self.req = self.account.getAccountRequest(self.user) + self.premium = self.account.isPremium(self.user) getInfo = create_getInfo(XFileSharingProFolder) diff --git a/module/plugins/crypter/_1KhDe.py b/module/plugins/crypter/_1KhDe.py new file mode 100644 index 000000000..c8ac3020c --- /dev/null +++ b/module/plugins/crypter/_1KhDe.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +import re + +from module.unescape import unescape +from module.plugins.Crypter import Crypter + + +class _1KhDe(Crypter): + __name__ = "1KhDe" + __type__ = "crypter" + __version__ = "0.11" + + __pattern__ = r'http://(?:www\.)?1kh\.de/f/' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """1kh.de decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org")] + + + def __init__(self, parent): + Crypter.__init__(self, parent) + self.parent = parent + + + def file_exists(self): + """ returns True or False + """ + return True + + + def proceed(self, url, location): + url = self.parent.url + self.html = self.load(url) + link_ids = re.findall(r"", self.load("http://1kh.de/l/" + id)).group(1)) + self.urls.append(new_link) diff --git a/module/plugins/crypter/_4ChanOrg.py b/module/plugins/crypter/_4ChanOrg.py new file mode 100644 index 000000000..a5e815639 --- /dev/null +++ b/module/plugins/crypter/_4ChanOrg.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Based on 4chandl by Roland Beermann (https://gist.github.com/enkore/3492599) + +import re + +from module.plugins.Crypter import Crypter + + +class _4ChanOrg(Crypter): + __name__ = "4ChanOrg" + __type__ = "crypter" + __version__ = "0.31" + + __pattern__ = r'http://(?:www\.)?boards\.4chan\.org/\w+/res/(\d+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """4chan.org folder decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [] + + + def decrypt(self, pyfile): + pagehtml = self.load(pyfile.url) + images = set(re.findall(r'(images\.4chan\.org/[^/]*/src/[^"<]*)', pagehtml)) + self.urls = ["http://" + image for image in images] -- cgit v1.2.3