diff options
| author | 2011-09-18 19:04:05 +0200 | |
|---|---|---|
| committer | 2011-09-18 19:04:05 +0200 | |
| commit | cb7bb3881a76e85110868643be04d200113d88f2 (patch) | |
| tree | abc99358b0249c998e477a69c1bc922b7d04ef6d /module/plugins/hoster | |
| parent | closed #371 (diff) | |
| download | pyload-cb7bb3881a76e85110868643be04d200113d88f2.tar.xz | |
plugin pack by zoidberg
Diffstat (limited to 'module/plugins/hoster')
| -rw-r--r-- | module/plugins/hoster/BezvadataCz.py | 66 | ||||
| -rw-r--r-- | module/plugins/hoster/CzshareCom.py | 173 | ||||
| -rw-r--r-- | module/plugins/hoster/DataportCz.py | 77 | ||||
| -rw-r--r-- | module/plugins/hoster/EdiskCz.py | 88 | ||||
| -rw-r--r-- | module/plugins/hoster/EuroshareEu.py | 71 | ||||
| -rw-r--r-- | module/plugins/hoster/FlyshareCz.py | 90 | ||||
| -rw-r--r-- | module/plugins/hoster/HellshareCz.py | 161 | ||||
| -rw-r--r-- | module/plugins/hoster/MultishareCz.py | 83 | ||||
| -rw-r--r-- | module/plugins/hoster/NahrajCz.py | 54 | ||||
| -rw-r--r-- | module/plugins/hoster/PrzeklejPl.py | 47 | ||||
| -rw-r--r-- | module/plugins/hoster/QuickshareCz.py | 100 | ||||
| -rw-r--r-- | module/plugins/hoster/SpeedfileCz.py | 80 | ||||
| -rw-r--r-- | module/plugins/hoster/StahnuTo.py | 97 | ||||
| -rw-r--r-- | module/plugins/hoster/UlozTo.py | 167 | ||||
| -rw-r--r-- | module/plugins/hoster/UloziskoSk.py | 95 | 
15 files changed, 1449 insertions, 0 deletions
| diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py new file mode 100644 index 000000000..f9784142f --- /dev/null +++ b/module/plugins/hoster/BezvadataCz.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster + +class BezvadataCz(Hoster): +    __name__ = "BezvadataCz" +    __type__ = "hoster" +    __pattern__ = r"http://(\w*\.)?bezvadata.cz/stahnout/.*" +    __version__ = "0.1" +    __description__ = """BezvaData.cz""" +    __author_name__ = ("zoidberg") + +    ID_PATTERN = r'<input type="hidden" name="souborId" value="([^"]+)">' +    HASH_PATTERN = r'<input type="hidden" name="souborHash" value="([^"]+)">' +    FILENAME_PATTERN = r'<title>BezvaData \| St�hnout soubor ([^<]+)</title>' +    OFFLINE_PATTERN = r'<title>BezvaData \| Soubor nenalezen</title>' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        if re.search(self.OFFLINE_PATTERN, self.html) is not None: +            self.offline() + +        found = re.search(self.FILENAME_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (FILENAME)") +        pyfile.name = found.group(1) + +        found = re.search(self.ID_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (ID)") +        souborId = found.group(1) + +        found = re.search(self.ID_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (HASH)") +        souborHash = found.group(1) + +        self.logDebug("URL:" + pyfile.url + " ID:" + souborId + " HASH:" + souborHash) + +        self.download(pyfile.url, post={ +            "souborId": souborId, +            "souborHash": souborHash, +            "_send": 'STAHNOUT SOUBOR' +        }) +        
\ No newline at end of file diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py new file mode 100644 index 000000000..8cab02317 --- /dev/null +++ b/module/plugins/hoster/CzshareCom.py @@ -0,0 +1,173 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        html = getURL(url, decode=True) +        if re.search(CzshareCom.FILE_OFFLINE_PATTERN, html): +            # File offline +            result.append((url, 0, 1, url)) +        else: +            # Get file info +            found = re.search(CzshareCom.FILE_NAME_PATTERN, html) +            if found is not None: +                name = found.group(1) +                result.append((name, 0, 2, url)) +    yield result + + +class CzshareCom(Hoster): +    __name__ = "CzshareCom" +    __type__ = "hoster" +    __pattern__ = r"http://.*czshare\.(com|cz)/.*" +    __version__ = "0.6" +    __description__ = """CZshare.com""" +    __author_name__ = ("zoidberg") + +    #FILE_URL_PATTERN = r'<a href="http://czshare.com/([^/]+)/([^/]+)/[^"]*">([^<]+)</a>' +    FILE_URL_PATTERN = r'<a href="([^"]+)" class="page-download">[^>]*alt="([^"]+)" /></a>' +    FORM_PATTERN = r'<form action="download.php" method="post">' +    ID_PATTERN = r'<input type="hidden" name="id" value="([^"]+)" />' +    FILE_PATTERN = r'<input type="hidden" name="file" value="([^"]+)" />' +    #TICKET_PATTERN = r'<input type="hidden" name="ticket" value="([^"]+)" />'  +    SUBMIT_PATTERN = r'<input type="submit" name="freedown" value="([^"]+)" class="button" />' +    SIZE_PATTERN = r'<input type="hidden" name="size" value="([^"]+)" />' +    SERVER_PATTERN = r'<input type="hidden" name="server" value="([^"]+)" />' +    FILE_OFFLINE_PATTERN = r'<h2 class="red">Soubor nenalezen<span> </span></h2>' +    MULTIDL_PATTERN = r"<p><font color='red'>Z[^<]*PROFI.</font></p>" +    FILE_NAME_PATTERN = r'<h1>([^<]+)<span> </span></h1>' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        #marks the file as "offline" when the pattern was found on the html-page +        if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: +            self.offline() + +        # parse the name from the site and set attribute in pyfile +        found = re.search(self.FILE_URL_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (URL)") + +        pyfile.name = found.group(2) +        parsed_url = "http://czshare.com" + found.group(1) + +        # get download ticket and parse html       +        self.logDebug("PARSED_URL:" + parsed_url) +        self.logDebug("NAME:" + pyfile.name) +        self.html = self.load(parsed_url) + +        #if not re.search(self.FORM_PATTERN, self.html): +        if re.search(self.MULTIDL_PATTERN, self.html): +            self.waitForFreeSlot() + +        parse_err = False + +        found = re.search(self.SERVER_PATTERN, self.html) +        if found is None: +            parse_err = True +            server = "" +        else: +            server = found.group(1) + +        found = re.search(self.ID_PATTERN, self.html) +        if found is None: +            parse_err = True +            file_id = "" +        else: +            file_id = found.group(1) + +        found = re.search(self.FILE_PATTERN, self.html) +        if found is None: +            parse_err = True +            long_id = "" +        else: +            long_id = found.group(1) + +        found = re.search(self.SIZE_PATTERN, self.html) +        if found is None: +            parse_err = True +            size = "" +        else: +            size = found.group(1) + +        self.logDebug("ID:" + file_id + " F:" + long_id + " B:" + size + " S:" + server) + +        if parse_err: +            self.fail("Parse error") + +        found = re.search(self.SUBMIT_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (SUBMIT)") +        else: +            submit = found.group(1) + +            # get and decrypt captcha +        captcha_url = 'http://czshare.com/captcha.php' +        """ +        if self.getConfig("randomCaptcha") == True: +           captcha = ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for i in range(5)) +        else: +        """ +        captcha = self.decryptCaptcha(captcha_url) +        self.logDebug('CAPTCHA_URL:' + captcha_url + ' CAPTCHA:' + captcha) + +        """ +        self.setWait(self.getConfig("multiWait"), True) +        self.wait()  +        """ + +        # download the file, destination is determined by pyLoad +        #download_url = 'http://czshare.com/free.php' +        self.download(parsed_url, post={ +            "id": file_id, +            "file": long_id, +            "size": size, +            "server": server, +            "captchastring2": captcha, +            "freedown": submit +        }) + +        # check download +        check = self.checkDownload({ +            "tempoffline": re.compile(r"^Soubor je do.asn. nedostupn.$"), +            "multi_dl": re.compile(self.MULTIDL_PATTERN), +            "captcha_err": re.compile(self.SUBMIT_PATTERN) +        }) + +        if check == "tempoffline": +            self.fail("File not available - try later") +        elif check == "multi_dl": +            self.waitForFreeSlot() +        elif check == "captcha_err": +            self.invalidCaptcha() +            self.retry() + +    def waitForFreeSlot(self): +        self.setWait(900, True) +        self.wait() +        self.retry()
\ No newline at end of file diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py new file mode 100644 index 000000000..ea1ed1282 --- /dev/null +++ b/module/plugins/hoster/DataportCz.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        html = getURL(url, decode=True) +        if re.search(DataportCz.FILE_OFFLINE_PATTERN, html): +            # File offline +            result.append((url, 0, 1, url)) +        else: +            # Get file info +            found = re.search(DataportCz.FILE_NAME_PATTERN, html) +            if found is not None: +                name = found.group(1) +                result.append((name, 0, 2, url)) +    yield result + + +class DataportCz(Hoster): +    __name__ = "DataportCz" +    __type__ = "hoster" +    __pattern__ = r"http://.*dataport.cz/file/.*" +    __version__ = "0.3" +    __description__ = """dataport.cz""" +    __author_name__ = ("zoidberg") + +    FILE_NAME_PATTERN = r'<h2 style="color: red;">([^<]+)</h2>' +    URL_PATTERN = r'<td><a href="([^"]+)"[^>]*class="ui-state-default button hover ui-corner-all "><strong>' +    NO_SLOTS_PATTERN = r'<td><a href="http://dataport.cz/kredit/"[^>]*class="ui-state-default button hover ui-corner-all ui-state-disabled">' +    FILE_OFFLINE_PATTERN = r'<h2>Soubor nebyl nalezen</h2>' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        if re.search(self.FILE_OFFLINE_PATTERN, self.html): +            self.offline() + +        if re.search(self.NO_SLOTS_PATTERN, self.html): +            self.setWait(900, True) +            self.wait() +            self.retry() + +        found = re.search(self.FILE_NAME_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (NAME)") +        pyfile.name = found.group(1) + +        found = re.search(self.URL_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (URL)") +        download_url = found.group(1) + +        self.download(download_url)            diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py new file mode 100644 index 000000000..f5291547f --- /dev/null +++ b/module/plugins/hoster/EdiskCz.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        html = getURL(url, decode=True) +        if re.search(EdiskCz.FILE_OFFLINE_PATTERN, html): +            # File offline +            result.append((url, 0, 1, url)) +        else: +            # Get file info +            found = re.search(EdiskCz.FILE_NAME_PATTERN, html) +            if found is not None: +                name = found.group(1) +                result.append((name, 0, 2, url)) +    yield result + + +class EdiskCz(Hoster): +    __name__ = "EdiskCz" +    __type__ = "hoster" +    __pattern__ = r"http://(\w*\.)?edisk.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.*" +    __version__ = "0.2" +    __description__ = """Edisk.cz""" +    __author_name__ = ("zoidberg") + +    URL_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">' +    FILE_NAME_PATTERN = r'<span class="fl" title="([^"]+)">' +    ACTION_PATTERN = r'/en/download/(\d+/.*\.html)' +    DLLINK_PATTERN = r'http://.*edisk.cz.*\.html' +    FILE_OFFLINE_PATTERN = r'<h3>This file does not exist due to one of the following:</h3><ul><li>' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        url = re.sub("/(stahni|sk/stahni)/", "/en/download/", pyfile.url) + +        self.logDebug('URL:' + url) + +        found = re.search(self.ACTION_PATTERN, url) +        if found is None: +            self.fail("Parse error (ACTION)") +        action = found.group(1) + +        self.html = self.load(url, decode=True) + +        if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: +            self.offline() + +        found = re.search(self.FILE_NAME_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (FILENAME)") +        pyfile.name = found.group(1) + +        self.logDebug('NAME:' + pyfile.name) + +        self.html = self.load(re.sub("/en/download/", "/en/download-slow/", url)) + +        url = self.load(re.sub("/en/download/", "/x-download/", url), post={ +            "action": action +        }) + +        if not re.match(self.DLLINK_PATTERN, url): +            self.fail("Unexpected server response") + +        self.download(url)        
\ No newline at end of file diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py new file mode 100644 index 000000000..1cb58bc3f --- /dev/null +++ b/module/plugins/hoster/EuroshareEu.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        html = getURL(url, decode=True) +        if re.search(EuroshareEu.FILE_OFFLINE_PATTERN, html): +            # File offline +            result.append((url, 0, 1, url)) +        else: +            result.append((url, 0, 2, url)) +    yield result + + +class EuroshareEu(Hoster): +    __name__ = "EuroshareEu" +    __type__ = "hoster" +    __pattern__ = r"http://(\w*\.)?euroshare.eu/file/.*" +    __version__ = "0.2" +    __description__ = """Euroshare.eu""" +    __author_name__ = ("zoidberg") + +    URL_PATTERN = r'<a class="free" href="([^"]+)"></a>' +    FILE_OFFLINE_PATTERN = r'<h2>S�bor sa nena.iel</h2>' +    ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: +            self.offline() + +        if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: +            self.waitForFreeSlot() + +        found = re.search(self.URL_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (URL)") +        parsed_url = found.group(1) + +        self.download(parsed_url, disposition=True) + +    def waitForFreeSlot(self): +        self.setWait(300, True) +        self.wait() +        self.retry() +        
\ No newline at end of file diff --git a/module/plugins/hoster/FlyshareCz.py b/module/plugins/hoster/FlyshareCz.py new file mode 100644 index 000000000..eb07f3d9e --- /dev/null +++ b/module/plugins/hoster/FlyshareCz.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        html = getURL(url, decode=True) +        if re.search(FlyshareCz.FILE_OFFLINE_PATTERN, html): +            # File offline +            result.append((url, 0, 1, url)) +        else: +            # Get file info +            found = re.search(FlyshareCz.FILE_NAME_PATTERN, html) +            if found is not None: +                name = found.group(1) +                result.append((name, 0, 2, url)) +    yield result + + +class FlyshareCz(Hoster): +    __name__ = "FlyshareCz" +    __type__ = "hoster" +    __pattern__ = r"http://.*flyshare.cz/stahni/.*" +    __version__ = "0.3" +    __description__ = """flyshare.cz""" +    __author_name__ = ("zoidberg") + +    FILE_NAME_PATTERN = r'<p><span class="filename">([^<]+)</span>' +    ERR_PATTERN = r'<p class="errorreport_error">Chyba: ([^<]+)</p>' +    FILE_OFFLINE_PATTERN = r'<p class="errorreport_error">Chyba: File is not available on the server</p>' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        found = re.search(self.ERR_PATTERN, self.html) +        if found is not None: +            err_dsc = found.group(1) +            if err_dsc == "Too many simultaneous downloads, try again later": +                self.waitForFreeSlot() +            elif err_dsc == "File is not available on the server": +                self.offline() +            else: +                self.fail(err_dsc) + +        found = re.search(self.FILE_NAME_PATTERN, self.html) +        if found is None: +            self.fail("Parse error") +        pyfile.name = found.group(1) + +        self.download(pyfile.url, post={ +            "wmod_command": "wmod_fileshare3:startDownload", +            "method": "free" +        }) + +        check = self.checkDownload({ +            "sim_dl": '<p class="errorreport_error">Chyba: Too many simultaneous downloads, try again later</p>' +        }) + +        if check == "sim_dl": +            self.waitForFreeSlot() + +    def waitForFreeSlot(self): +        self.setWait(600, True) +        self.wait() +        self.retry() +            +         diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py new file mode 100644 index 000000000..7ff5e5367 --- /dev/null +++ b/module/plugins/hoster/HellshareCz.py @@ -0,0 +1,161 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +import datetime +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        html = getURL(url, decode=True) +        if re.search(HellshareCz.FILE_OFFLINE_PATTERN, html): +            # File offline +            result.append((url, 0, 1, url)) +        else: +            # Get file info +            found = re.search(HellshareCz.FILE_NAME_PATTERN, html) +            if found is not None: +                name = found.group(1) +                result.append((name, 0, 2, url)) +    yield result + + +class HellshareCz(Hoster): +    __name__ = "HellshareCz" +    __type__ = "hoster" +    __pattern__ = r"http://(.*\.)*hellshare\.(cz|com|sk|hu)/.*" +    __version__ = "0.6" +    __description__ = """Hellshare.cz""" +    __author_name__ = ("zoidberg") + +    FREE_URL_PATTERN = r'<a id="button-download-free" href="([^"]*)"' +    PREMIUM_URL_PATTERN = r'<a onclick="return launchFullDownload[^>]*href="(http://[^/]+/([^/]+)/[^"]+)" target="full-download-iframe">' +    FILE_NAME_PATTERN = r'<strong id="FileName_master">([^<]+)</strong>' +    FILE_OFFLINE_PATTERN = r'<h1>Soubor nenalezen</h1>' +    SERVER_PATTERN = r'<form method="post" action="([^"]+)">' +    CAPTCHA_PATTERN = r'<p class="text-center marg-off"><img id="captcha-img" class="va-middle" src="([^"]+)"' +    FILE_CREDITS_PATTERN = r'<strong style="font-size:20px;">(\d+)\s*credits</strong>' +    CREDIT_LEFT_PATTERN = r'<a class="button-amount-1" href="[^>]*/buy-credit/" title="Your current credit">([^<]+)</a>' +    DOWNLOAD_AGAIN_PATTERN = r'Soubor jste ji. stahoval - opakovan. download prob.hne zdarma. Pokra.ovat' + +    def setup(self): +        self.resumeDownload = self.multiDL = True if self.account else False +        self.chunkLimit = 1 + +    def process(self, pyfile): +        if self.premium and self.account is not None: +            self.account.relogin(self.user) +            self.getFileInfo(pyfile) +            self.handlePremium() +        else: +            self.getFileInfo(pyfile) +            self.handleFree() + +    def getFileInfo(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        #marks the file as "offline" when the pattern was found on the html-page +        if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: +            self.offline() + +        # parse the name from the site and set attribute in pyfile        +        found = re.search(self.FILE_NAME_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (Filename") +        pyfile.name = found.group(1) + +    def handleFree(self): +        # parse free download url +        found = re.search(self.FREE_URL_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (URL)") + +        parsed_url = found.group(1) + +        if parsed_url == "": +            t = datetime.datetime.today().replace(hour=1, minute=0, second=0) + datetime.timedelta( +                days=1) - datetime.datetime.today() +            self.setWait(t.seconds, True) +            self.wait() +            self.retry() + +        # get download ticket and parse html +        self.logDebug("PARSED_URL:" + parsed_url) +        self.html = self.load(parsed_url) + +        found = re.search(self.SERVER_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (Server)") +        download_url = found.group(1) + +        found = re.search(self.CAPTCHA_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (Captcha)") +        captcha_url = found.group(1) + +        # get and decrypt captcha +        captcha = self.decryptCaptcha(captcha_url) +        self.logDebug('CAPTCHA_URL:' + captcha_url + ' CAPTCHA:' + captcha) + +        # download the file, destination is determined by pyLoad +        self.download(download_url, post={ +            "captcha": captcha +        }) + +        # check download +        check = self.checkDownload({ +            "wrong_captcha": "<p>Incorrectly copied code from the image</p>" +        }) + +        if check == "wrong_captcha": +            self.invalidCaptcha() +            self.retry() + +    def handlePremium(self): +        found = re.search(self.FILE_CREDITS_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (Credits)") +        file_credits = int(found.group(1)) + +        found = re.search(self.CREDIT_LEFT_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (Credits left)") +        credits_left = int(found.group(1)) + +        self.logInfo("Premium download for %i credits" % file_credits) +        self.logInfo("User %s has %i credits left" % (self.user, credits_left)) + +        if file_credits > credits_left and not re.search(self.DOWNLOAD_AGAIN_PATTERN, self.html): +            self.resetAccount() + +        found = re.search(self.PREMIUM_URL_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (URL)") +        download_url = found.group(1) + +        self.download(download_url) + +        info = self.account.getAccountInfo(self.user, True) +        self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"] / 1024)) +         +             +             +         diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py new file mode 100644 index 000000000..488fdcbc4 --- /dev/null +++ b/module/plugins/hoster/MultishareCz.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        try: +            html = getURL(url, decode=True) +        except Exception: +            result.append((url, 0, 1, url)) +        else: +            if re.search(MultishareCz.OFFLINE_PATTERN, html): +                # File offline +                result.append((url, 0, 1, url)) +            else: +                # Get file info +                found = re.search(MultishareCz.FILE_INFO_PATTERN, html) +                if found is not None: +                    name = found.group(1) +                    size = float(found.group(2)) +                    units = found.group(3) + +                    pow = {'KB': 1, 'MB': 2, 'GB': 3}[units] +                    size = int(size * 1024 ** pow) + +                    result.append((name, size, 2, url)) +    yield result + + +class MultishareCz(Hoster): +    __name__ = "MultishareCz" +    __type__ = "hoster" +    __pattern__ = r"http://(\w*\.)?multishare.cz/stahnout/.*" +    __version__ = "0.2" +    __description__ = """MultiShare.cz""" +    __author_name__ = ("zoidberg") + +    FILE_ID_PATTERN = r'/stahnout/(\d+)/' +    FILE_INFO_PATTERN = r'<ul class="no-padding"><li>N�zev: <strong>([^<]+)</strong></li><li>Velikost: <strong>([^&]+) ([^<]+)</strong>' +    OFFLINE_PATTERN = r'<h1>St�hnout soubor</h1><p><strong>Po.adovan� soubor neexistuje.</strong></p>' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        if re.search(self.OFFLINE_PATTERN, self.html) is not None: +            self.offline() + +        found = re.search(self.FILE_ID_PATTERN, pyfile.url) +        if found is None: +            self.fail("Parse error (ID)") +        file_id = found.group(1) + +        found = re.search(self.FILE_INFO_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (NAME)") +        pyfile.name = found.group(1) + +        self.download("http://www.multishare.cz/html/download_free.php", get={ +            "ID": file_id +        }) diff --git a/module/plugins/hoster/NahrajCz.py b/module/plugins/hoster/NahrajCz.py new file mode 100644 index 000000000..634c1af7d --- /dev/null +++ b/module/plugins/hoster/NahrajCz.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster + +class NahrajCz(Hoster): +    __name__ = "NahrajCz" +    __type__ = "hoster" +    __pattern__ = r"http://.*nahraj.cz/content/download/.*" +    __version__ = "0.2" +    __description__ = """nahraj.cz""" +    __author_name__ = ("zoidberg") + +    FILE_URL_PATTERN = r'<form id="forwarder" method="post"[^>]*action="([^"]+/([^/"]+))">' +    SUBMIT_PATTERN = r'<input id="submit" type="submit" value="([^"]+)" name="submit"/>' +    #ERR_PATTERN = r'<p class="errorreport_error">Chyba: ([^<]+)</p>' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url) + +        found = re.search(self.FILE_URL_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (URL)") +        parsed_url = found.group(1) +        pyfile.name = found.group(2) + +        found = re.search(self.SUBMIT_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (SUBMIT)") +        submit = found.group(1) + +        self.download(parsed_url, disposition=True, post={ +            "submit": submit +        }) +        
\ No newline at end of file diff --git a/module/plugins/hoster/PrzeklejPl.py b/module/plugins/hoster/PrzeklejPl.py new file mode 100644 index 000000000..e97fb551e --- /dev/null +++ b/module/plugins/hoster/PrzeklejPl.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster + +class PrzeklejPl(Hoster): +    __name__ = "PrzeklejPl" +    __type__ = "hoster" +    __pattern__ = r"http://.*przeklej.pl/plik/.*" +    __version__ = "0.1" +    __description__ = """przeklej.pl""" +    __author_name__ = ("zoidberg") + +    FILE_URL_PATTERN = r'<a href="([^"]+)" title="Pobierz plik">([^<]+)</a>' + +    #ERR_PATTERN = r'<p class="errorreport_error">Chyba: ([^<]+)</p>' + +    def setup(self): +        self.multiDL = True + +    def process(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        found = re.search(self.FILE_URL_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (URL)") +        parsed_url = found.group(1) +        pyfile.name = found.group(2) + +        self.download("http://www.przeklej.pl" + parsed_url) +        
\ No newline at end of file diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py new file mode 100644 index 000000000..fe8d6febe --- /dev/null +++ b/module/plugins/hoster/QuickshareCz.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        try: +            html = getURL(url, decode=True) + +            if re.search(QuickshareCz.FILE_OFFLINE_PATTERN, html): +                # File offline +                result.append((url, 0, 1, url)) +            else: +                # Get file info +                found = re.search(QuickshareCz.VAR_PATTERN, html) +                if found is not None: +                    name = found.group('ID3') + +                    found = re.search(QuickshareCz.FILE_SIZE_PATTERN, html) +                    if found is not None: +                        size = float(found.group(1)) +                        units = found.group(2) + +                        pow = {'kB': 1, 'MB': 2, 'GB': 3}[units] +                        size = int(size * 1024 ** pow) + +                        result.append((name, size, 2, url)) +        except: +            result.append((url, 0, 1, url)) + +    yield result + + +class QuickshareCz(Hoster): +    __name__ = "QuickshareCz" +    __type__ = "hoster" +    __pattern__ = r"http://.*quickshare.cz/stahnout-soubor/.*" +    __version__ = "0.5" +    __description__ = """Quickshare.cz""" +    __author_name__ = ("zoidberg") + +    VAR_PATTERN = r"var ID1 = '(?P<ID1>[^']+)';var ID2 = '(?P<ID2>[^']+)';var ID3 = '(?P<ID3>[^']+)';var ID4 = '(?P<ID4>[^']+)';var ID5 = '[^']*';var UU_prihlasen = '[^']*';var UU_kredit = [^;]*;var velikost = [^;]*;var kredit_odecet = [^;]*;var CaptchaText = '(?P<CaptchaText>[^']+)';var server = '(?P<Server>[^']+)';" +    FILE_OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>' +    FILE_SIZE_PATTERN = r'<br>Velikost: <strong>([0-9.]+)</strong>\s*(KB|MB|GB)<br>' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url) + +        # marks the file as "offline" when the pattern was found on the html-page +        if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: +            self.offline() + +        # parse the name from the site and set attribute in pyfile +        parsed_vars = re.search(self.VAR_PATTERN, self.html) +        if parsed_vars is None: +            self.fail("Parser error") +            # unreachable: pyfile.name = unicode(parsed_vars.group('ID3'), 'utf-8') + +        # download the file, destination is determined by pyLoad +        download_url = parsed_vars.group('Server') + "/download.php" +        self.log.debug("File:" + pyfile.name) +        self.log.debug("URL:" + download_url) + +        self.download(download_url, post={ +            "ID1": parsed_vars.group('ID1'), +            "ID2": parsed_vars.group('ID2'), +            "ID3": parsed_vars.group('ID3'), +            "ID4": parsed_vars.group('ID4') +        }) + +        # check download +        check = self.checkDownload({ +            "no_slots": "obsazen na 100 %" +        }) + +        if check == "no_slots": +            self.retry(5, 600, "No free slots") diff --git a/module/plugins/hoster/SpeedfileCz.py b/module/plugins/hoster/SpeedfileCz.py new file mode 100644 index 000000000..0c5010b15 --- /dev/null +++ b/module/plugins/hoster/SpeedfileCz.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        html = getURL(url, decode=True) +        if re.search(SpeedfileCz.FILE_OFFLINE_PATTERN, html): +            # File offline +            result.append((url, 0, 1, url)) +        else: +            # Get file info +            found = re.search(SpeedfileCz.FILE_NAME_PATTERN, html) +            if found is not None: +                name = found.group(1) +                result.append((name, 0, 2, url)) +    yield result + + +class SpeedfileCz(Hoster): +    __name__ = "SpeedFileCz" +    __type__ = "hoster" +    __pattern__ = r"http://speedfile.cz/.*" +    __version__ = "0.3" +    __description__ = """speedfile.cz""" +    __author_name__ = ("zoidberg") + +    FILE_NAME_PATTERN = r'<meta property="og:title" content="([^"]+)" />' +    URL_PATTERN = r'<a id="request" class="caps" href="([^"]+)" rel="nofollow">' +    FILE_OFFLINE_PATTERN = r'<title>Speedfile \| 404' +    WAIT_PATTERN = r'"requestedAt":(\d+),"allowedAt":(\d+),"adUri"' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        if re.search(self.FILE_OFFLINE_PATTERN, self.html): +            self.offline() + +        found = re.search(self.FILE_NAME_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (NAME)") +        pyfile.name = found.group(1) + +        found = re.search(self.URL_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (URL)") +        download_url = "http://speedfile.cz/" + found.group(1) + +        self.html = self.load(download_url) +        self.logDebug(self.html) +        found = re.search(self.WAIT_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (WAIT)") +        self.setWait(int(found.group(2)) - int(found.group(1))) +        self.wait() + +        self.download(download_url)            diff --git a/module/plugins/hoster/StahnuTo.py b/module/plugins/hoster/StahnuTo.py new file mode 100644 index 000000000..0413853dd --- /dev/null +++ b/module/plugins/hoster/StahnuTo.py @@ -0,0 +1,97 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        html = getURL("http://stahnu.to/?file=" + re.search(StahnuTo.__pattern__, url).group(3), decode=True) +        if re.search(StahnuTo.FILE_OFFLINE_PATTERN, html): +            # File offline +            result.append((url, 0, 1, url)) +        else: +            # Get file info +            found = re.search(StahnuTo.FILE_NAME_PATTERN, html) +            if found is not None: +                name = found.group(1) + +                found = re.search(StahnuTo.FILE_SIZE_PATTERN, html) +                if found is not None: +                    size = float(found.group(1)) +                    units = found.group(2) + +                    pow = {'kB': 1, 'Mb': 2, 'Gb': 3}[units] +                    size = int(size * 1024 ** pow) + +                    result.append((name, size, 2, url)) +    yield result + + +class StahnuTo(Hoster): +    __name__ = "StahnuTo" +    __type__ = "hoster" +    __pattern__ = r"http://(\w*\.)?stahnu.to/(files/get/|.*\?file=)([^/]+).*" +    __version__ = "0.1" +    __description__ = """stahnu.to""" +    __author_name__ = ("zoidberg") + +    FILE_NAME_PATTERN = r"<div class='nadpis-01'><h2>([^<]+)</h2></div>" +    FILE_SIZE_PATTERN = r'<td>Velikost souboru<br /><span>([^<]+)\s*(kb|Mb|Gb)</span></td>' +    FILE_OFFLINE_PATTERN = r'<!-- Obsah - start -->\s*<!-- Obsah - end -->' +    #FILE_OFFLINE_PATTERN = r'<h2 align="center">Tento soubor neexistuje  nebo byl odstraněn! </h2>' +    CAPTCHA_PATTERN = r'<img src="captcha/captcha.php" id="captcha" /></td>' + + +    def setup(self): +        self.multiDL = True + +    def process(self, pyfile): +        found = re.search(self.__pattern__, pyfile.url) +        if found is None: +            self.fail("Wrong URL") +        file_id = found.group(3) + +        self.html = self.load("http://stahnu.to/?file=" + file_id, decode=True) + +        if re.search(self.FILE_OFFLINE_PATTERN, self.html): +            self.offline() + +        found = re.search(self.FILE_NAME_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (NAME)") +        pyfile.name = found.group(1) + +        """ +        captcha = self.decryptCaptcha("http://stahnu.to/captcha/captcha.php", cookies=True) + +        self.html = self.load("http://stahnu.to/?file=" + file_id, cookies=True, post={ +        if re.search(self.CAPTCHA_PATTERN, self.html) is not None:                                          +            self.invalidCaptcha() +            self.retry() +             +        """ + +        self.download("http://stahnu.to/files/gen/" + file_id, post={ +            "file": file_id, +            "user": "Anonym", +            "commenttext": "" +        }) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py new file mode 100644 index 000000000..b16240ab7 --- /dev/null +++ b/module/plugins/hoster/UlozTo.py @@ -0,0 +1,167 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        try: +            html = getURL(url, decode=True) + +            if re.search(UlozTo.FILE_OFFLINE_PATTERN, html): +                # File offline +                result.append((url, 0, 1, url)) +            else: +                # Get file info +                name = '' +                found = re.search(UlozTo.FILE_NAME_PATTERN, html) +                if found is not None: +                    name = found.group(1) +                else: +                    found = re.search(UlozTo.LIVE_NAME_PATTERN, html) +                    if found is not None: +                        name = found.group(1) + +                if name: +                    found = re.search(UlozTo.FILE_SIZE_PATTERN, html) +                    if found is not None: +                        size = float(found.group(1)) +                        units = found.group(2) + +                        pow = {'kB': 1, 'MB': 2, 'GB': 3}[units] +                        size = int(size * 1024 ** pow) + +                        result.append((name, size, 2, url)) +        except Exception: +            result.append((url, 0, 1, url)) + +    yield result + + +class UlozTo(Hoster): +    __name__ = "UlozTo" +    __type__ = "hoster" +    __pattern__ = r"http://(\w*\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/.*" +    __version__ = "0.7" +    __description__ = """uloz.to""" +    __config__ = [("reuseCaptcha", "bool", "Reuse captcha", "True"), +        ("captchaUser", "str", "captcha_user", ""), +        ("captchaNb", "str", "captcha_nb", "")] +    __author_name__ = ("zoidberg") + +    FILE_URL_PATTERN = r'<form name="dwn" action="([^"]+)"' +    FILE_NAME_PATTERN = r'<h2 class="nadpis" style="margin-left:196px;"><a href="[^"]+">([^<]+)</a></h2>' +    CAPTCHA_PATTERN = r'<img style=".*src="([^"]+)" alt="Captcha" class="captcha"' +    CAPTCHA_NB_PATTERN = r'<input class="captcha_nb" type="hidden" name="captcha_nb" value="([0-9]+)" >' +    FILE_OFFLINE_PATTERN = r'href="http://www.ulozto.net/(neexistujici|smazano)/\?lg=en&' +    PASSWD_PATTERN = r'<input type="password" class="text" name="file_password" id="frmfilepasswordForm-file_password" />' +    LIVE_URL_PATTERN = r'<div id="flashplayer"[^>]*>\s*<a href="([^"]+)"' +    LIVE_NAME_PATTERN = r'<a share_url="[^&]*&t=([^"]+)"' +    FILE_SIZE_PATTERN = r'<div class="info_velikost" style="top:-55px;">\s*<div>[^<]*\s+([0-9.]+)\s(kB|MB|GB)\s*</div>\s*</div>' +    VIPLINK_PATTERN = r'<a href="[^"]*\?disclaimer=1" class="linkVip">' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        #marks the file as "offline" when the pattern was found on the html-page +        if re.search(self.FILE_OFFLINE_PATTERN, self.html): +            self.offline() + +        if re.search(self.VIPLINK_PATTERN, self.html): +            self.html = self.load(pyfile.url, get={"disclaimer": "1"}) + +        found = re.search(self.LIVE_URL_PATTERN, self.html) +        if found is not None: +            # Uloz.to LIVE        +            parsed_url = found.group(1) +            self.logDebug("LIVE URL:" + parsed_url) + +            found = re.search(self.LIVE_NAME_PATTERN, self.html) +            if found is None: +                self.fail("Parse error (LIVE_NAME)") +            pyfile.name = found.group(1) +            self.log.debug("LIVE NAME:" + pyfile.name) + +            self.download(parsed_url) +        else: +            # Uloz.to DATA +            # parse the name from the site and set attribute in pyfile +            found = re.search(self.FILE_NAME_PATTERN, self.html) +            if found is None: +                self.fail("Parse error (FILENAME)") +            pyfile.name = found.group(1) +            self.log.debug("PARSED_NAME:" + pyfile.name) + +            found = re.search(self.FILE_URL_PATTERN, self.html) +            if found is None: +                self.fail("Parse error (URL)") +            parsed_url = found.group(1) +            self.log.debug("PARSED_URL:" + parsed_url) + +            # get and decrypt captcha +            reuse_captcha = self.getConfig("reuseCaptcha") +            captcha = self.getConfig("captchaUser") +            captcha_nb = self.getConfig("captchaNb") +            captcha_url = "DUMMY" + +            if not reuse_captcha or not captcha or not captcha_nb: +                found = re.search(self.CAPTCHA_PATTERN, self.html) +                if found is None: +                    self.fail("Parse error (CAPTCHA)") +                captcha_url = found.group(1) +                captcha = self.decryptCaptcha(captcha_url) +                found = re.search(self.CAPTCHA_NB_PATTERN, self.html) +                if found is None: +                    self.fail("Parse error (CAPTCHA_NB)") +                captcha_nb = found.group(1) +            self.log.debug('CAPTCHA_URL:' + captcha_url + ' CAPTCHA:' + captcha + ' CAPTCHA_NB:' + captcha_nb) + +            # download the file, destination is determined by pyLoad +            self.download(parsed_url, post={ +                "captcha_user": captcha, +                "captcha_nb": captcha_nb +            }) + +            check = self.checkDownload({ +                "wrong_captcha": re.compile(self.CAPTCHA_PATTERN), +                "offline": re.compile(self.FILE_OFFLINE_PATTERN), +                "passwd": self.PASSWD_PATTERN +            }) + +            if check == "wrong_captcha": +                if reuse_captcha: +                    self.setConfig("captchaUser", "") +                    self.setConfig("captchaNb", "") +                self.invalidCaptcha() +                self.retry(reason="Wrong captcha code") +            elif check == "offline": +                self.offline() +            elif check == "passwd": +                self.fail("Password protected") + +            if reuse_captcha: +                self.setConfig("captchaUser", captcha) +                self.setConfig("captchaNb", captcha_nb) +        
\ No newline at end of file diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py new file mode 100644 index 000000000..b8ec0df55 --- /dev/null +++ b/module/plugins/hoster/UloziskoSk.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU 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 General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): +    result = [] + +    for url in urls: +        html = getURL(url, decode=True) +        if re.search(UloziskoSk.FILE_OFFLINE_PATTERN, html): +            # File offline +            result.append((url, 0, 1, url)) +        else: +            # Get file info +            found = re.search(UloziskoSk.FILE_NAME_PATTERN, html) +            if found is not None: +                name = found.group(1) +                result.append((name, 0, 2, url)) +    yield result + + +class UloziskoSk(Hoster): +    __name__ = "UloziskoSk" +    __type__ = "hoster" +    __pattern__ = r"http://(\w*\.)?ulozisko.sk/.*" +    __version__ = "0.1" +    __description__ = """Ulozisko.sk""" +    __author_name__ = ("zoidberg") + +    URL_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">' +    ID_PATTERN = r'<input type = "hidden" name = "id" value = "([^"]+)" />' +    FILE_NAME_PATTERN = r'<input type = "hidden" name = "name" value = "([^"]+)" />' +    CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky.php\?fid=[^"]+)" alt="" />' +    FILE_OFFLINE_PATTERN = r'<span class = "red">Zadan� s�bor neexistuje z jedn�ho z nasleduj�cich d�vodov:</span>' + +    def setup(self): +        self.multiDL = False + +    def process(self, pyfile): +        self.html = self.load(pyfile.url, decode=True) + +        if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: +            self.offline() + +        found = re.search(self.URL_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (URL)") +        parsed_url = 'http://www.ulozisko.sk' + found.group(1) + +        found = re.search(self.FILE_NAME_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (FILENAME)") +        pyfile.name = found.group(1) + +        found = re.search(self.ID_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (ID)") +        id = found.group(1) + +        self.logDebug('URL:' + parsed_url + ' NAME:' + pyfile.name + ' ID:' + id) + +        found = re.search(self.CAPTCHA_PATTERN, self.html) +        if found is None: +            self.fail("Parse error (CAPTCHA)") +        captcha_url = 'http://www.ulozisko.sk' + found.group(1) + +        captcha = self.decryptCaptcha(captcha_url, cookies=True) + +        self.logDebug('CAPTCHA_URL:' + captcha_url + ' CAPTCHA:' + captcha) + +        self.download(parsed_url, post={ +            "antispam": captcha, +            "id": id, +            "name": pyfile.name, +            "but": "++++STIAHNI+S%DABOR++++" +        }) +        
\ No newline at end of file | 
