diff options
| author | 2013-04-06 00:07:25 +0200 | |
|---|---|---|
| committer | 2013-04-06 00:07:25 +0200 | |
| commit | 7379731d2f26e0a45e19b8f1cc6342115a0f559c (patch) | |
| tree | 701f5e4c5103d047b702237a8d84a66edd7e054e /module/plugins/crypter | |
| parent | parseFileSize fix (diff) | |
| parent | EgoFilesCom: fixed bug in premium downloads. (diff) | |
| download | pyload-7379731d2f26e0a45e19b8f1cc6342115a0f559c.tar.xz | |
Merge plugins from  stable.
Conflicts:
	module/plugins/internal/UnRar.py
Diffstat (limited to 'module/plugins/crypter')
| -rw-r--r-- | module/plugins/crypter/DataHuFolder.py | 55 | ||||
| -rw-r--r-- | module/plugins/crypter/FourChanOrg.py | 38 | ||||
| -rw-r--r-- | module/plugins/crypter/GooGl.py | 26 | ||||
| -rw-r--r-- | module/plugins/crypter/UlozToFolder.py | 2 | 
4 files changed, 94 insertions, 27 deletions
| diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHuFolder.py new file mode 100644 index 000000000..f710f60d7 --- /dev/null +++ b/module/plugins/crypter/DataHuFolder.py @@ -0,0 +1,55 @@ +# -*- 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 <http://www.gnu.org/licenses/>.    # +############################################################################ + +import re + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class DataHuFolder(SimpleCrypter): +    __name__ = "DataHuFolder" +    __type__ = "crypter" +    __pattern__ = r"http://(www\.)?data.hu/dir/\w+" +    __version__ = "0.03" +    __description__ = """Data.hu Folder Plugin""" +    __author_name__ = ("crash", "stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    LINK_PATTERN = r"<a href='(http://data\.hu/get/.+)' target='_blank'>\1</a>" +    TITLE_PATTERN = ur'<title>(?P<title>.+) Let\xf6lt\xe9se</title>' + +    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() +            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 +                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') 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 = '[<a href="(res/\d*\.html)">Reply</a>]' -            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 : <a href="(http://(?:img\.)?(?:zip\.)?4chan\.org/\w{,3}/src/\d*\..{3})"', html) -        self.links = temp_links +        self.core.files.addLinks(urls, self.pyfile.package().id) 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') 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") | 
