From 495bf10578110b1af3e91300d6a778be4e601946 Mon Sep 17 00:00:00 2001 From: enkore Date: Mon, 25 Mar 2013 22:11:58 +0100 Subject: Rewrote FourChanOrg crypter --- module/plugins/crypter/FourChanOrg.py | 38 +++++++++++------------------------ 1 file changed, 12 insertions(+), 26 deletions(-) (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/FourChanOrg.py b/module/plugins/crypter/FourChanOrg.py index cbcdd920c..5c96e723d 100644 --- a/module/plugins/crypter/FourChanOrg.py +++ b/module/plugins/crypter/FourChanOrg.py @@ -6,34 +6,20 @@ import re from module.plugins.Crypter import Crypter class FourChanOrg(Crypter): + # Based on 4chandl by Roland Beermann + # https://gist.github.com/enkore/3492599 __name__ = "FourChanOrg" __type__ = "container" - __pattern__ = r"http://(www\.)?(img\.)?(zip\.)?4chan.org/\w+/(res/|imgboard\.html)" - __version__ = "0.1" - __description__ = """4chan.org Thread Download Plugin""" - __author_name__ = ("Spoob") - __author_mail__ = ("Spoob@pyload.org") + __version__ = "0.3" + __pattern__ = r"http://boards\.4chan.org/\w+/res/(\d+)" + __description__ = "Downloader for entire 4chan threads" - def __init__(self, parent): - Crypter.__init__(self, parent) - self.parent = parent - self.html = None + def decrypt(self, pyfile): + pagehtml = self.load(pyfile.url) - def file_exists(self): - """ returns True or False - """ - return True + images = set(re.findall(r'(images\.4chan\.org/[^/]*/src/[^"<]*)', pagehtml)) + urls = [] + for image in images: + urls.append("http://" + image) - def proceed(self, url, location): - url = self.parent.url - html = self.req.load(url) - link_pattern = "" - temp_links = [] - if "imagebord.html" in url: - link_pattern = '[Reply]' - temp_links = re.findall(link_pattern, html) - for link in re.findall(link_pattern, html): - temp_links.append(link) - else: - temp_links = re.findall('File : Date: Sat, 30 Mar 2013 21:20:35 +0100 Subject: Two plugins updated to avoid errors in 0.5 --- module/plugins/crypter/UlozToFolder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/UlozToFolder.py b/module/plugins/crypter/UlozToFolder.py index c6672ea8c..814d5240d 100644 --- a/module/plugins/crypter/UlozToFolder.py +++ b/module/plugins/crypter/UlozToFolder.py @@ -7,7 +7,7 @@ class UlozToFolder(Crypter): __name__ = "UlozToFolder" __type__ = "crypter" __pattern__ = r"http://.*(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(m|soubory)/.*" - __version__ = "0.1a" + __version__ = "0.2" __description__ = """Uloz.to Folder Plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") -- cgit v1.2.3 From f802d769fac6e1c2e296507df2a56ce4b79e9ec1 Mon Sep 17 00:00:00 2001 From: Stefano Date: Sun, 31 Mar 2013 15:15:40 +0200 Subject: New crypter plugin for Goo.gl --- module/plugins/crypter/GooGl.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 module/plugins/crypter/GooGl.py (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/GooGl.py b/module/plugins/crypter/GooGl.py new file mode 100644 index 000000000..07de5e008 --- /dev/null +++ b/module/plugins/crypter/GooGl.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Crypter import Crypter +from module.common.json_layer import json_loads + + +class GooGl(Crypter): + __name__ = "GooGl" + __type__ = "crypter" + __pattern__ = r"https?://(www\.)?goo\.gl/\w+" + __version__ = "0.01" + __description__ = """Goo.gl Crypter Plugin""" + __author_name__ = ("stickell") + __author_mail__ = ("l.stickell@yahoo.it") + + API_URL = 'https://www.googleapis.com/urlshortener/v1/url' + + def decrypt(self, pyfile): + rep = self.load(self.API_URL, get={'shortUrl': pyfile.url}) + self.logDebug('JSON data: ' + rep) + rep = json_loads(rep) + + if 'longUrl' in rep: + self.core.files.addLinks([rep['longUrl']], self.pyfile.package().id) + else: + self.fail('Unable to expand shortened link') -- cgit v1.2.3 From 062ba46a2c99c7fefe1223d2d2694f4a84082764 Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 2 Apr 2013 20:24:52 +0200 Subject: New crypter for Data.hu folders --- module/plugins/crypter/DataHuFolder.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 module/plugins/crypter/DataHuFolder.py (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHuFolder.py new file mode 100644 index 000000000..5d0d38f79 --- /dev/null +++ b/module/plugins/crypter/DataHuFolder.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class DataHuFolder(SimpleCrypter): + __name__ = "DataHuFolder" + __type__ = "crypter" + __pattern__ = r"http://(www\.)?data.hu/dir/\w+" + __version__ = "0.01" + __description__ = """Data.hu Folder Plugin""" + __author_name__ = ("crash") + + LINK_PATTERN = r"\1" + TITLE_PATTERN = ur'(.+) Let\xf6lt\xe9se' -- cgit v1.2.3 From 1a95a01a675fc46e178a194a834578ab149db403 Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 2 Apr 2013 21:43:28 +0200 Subject: DataHuFolder: added support to password protected folders --- module/plugins/crypter/DataHuFolder.py | 44 +++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHuFolder.py index 5d0d38f79..a93e33cea 100644 --- a/module/plugins/crypter/DataHuFolder.py +++ b/module/plugins/crypter/DataHuFolder.py @@ -1,5 +1,22 @@ # -*- coding: utf-8 -*- +############################################################################ +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +############################################################################ + +import re + from module.plugins.internal.SimpleCrypter import SimpleCrypter @@ -7,9 +24,30 @@ class DataHuFolder(SimpleCrypter): __name__ = "DataHuFolder" __type__ = "crypter" __pattern__ = r"http://(www\.)?data.hu/dir/\w+" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Data.hu Folder Plugin""" - __author_name__ = ("crash") + __author_name__ = ("crash", "stickell") + __author_mail__ = ("l.stickell@yahoo.it") LINK_PATTERN = r"\1" - TITLE_PATTERN = ur'(.+) Let\xf6lt\xe9se' + TITLE_PATTERN = ur'(?P<title>.+) Let\xf6lt\xe9se' + + def decrypt(self, pyfile): + self.html = self.load(pyfile.url, decode=True) + + if u'K\xe9rlek add meg a jelsz\xf3t' in self.html: # Password protected + password = self.getPassword() + self.logDebug('The folder is password protected', 'Using password: ' + password) + self.html = self.load(pyfile.url, post={'mappa_pass': password}, decode=True) + if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password + self.fail("Incorrect password, please set right password on Add package form and retry") + + package_name, folder_name = self.getPackageNameAndFolder() + + package_links = re.findall(self.LINK_PATTERN, self.html) + self.logDebug('Package has %d links' % len(package_links)) + + if package_links: + self.packages = [(package_name, package_links, folder_name)] + else: + self.fail('Could not extract any links') -- cgit v1.2.3 From e1993f0517457942ca30d9c9f2991070bb1e6543 Mon Sep 17 00:00:00 2001 From: Stefano Date: Wed, 3 Apr 2013 14:38:48 +0200 Subject: DataHuFolder: error message if folder is password protected but no password is specified --- module/plugins/crypter/DataHuFolder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHuFolder.py index a93e33cea..f710f60d7 100644 --- a/module/plugins/crypter/DataHuFolder.py +++ b/module/plugins/crypter/DataHuFolder.py @@ -24,7 +24,7 @@ class DataHuFolder(SimpleCrypter): __name__ = "DataHuFolder" __type__ = "crypter" __pattern__ = r"http://(www\.)?data.hu/dir/\w+" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Data.hu Folder Plugin""" __author_name__ = ("crash", "stickell") __author_mail__ = ("l.stickell@yahoo.it") @@ -37,6 +37,8 @@ class DataHuFolder(SimpleCrypter): if u'K\xe9rlek add meg a jelsz\xf3t' in self.html: # Password protected password = self.getPassword() + if password is '': + self.fail("No password specified, please set right password on Add package form and retry") self.logDebug('The folder is password protected', 'Using password: ' + password) self.html = self.load(pyfile.url, post={'mappa_pass': password}, decode=True) if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password -- cgit v1.2.3