diff options
| author | 2016-05-22 23:50:55 +0200 | |
|---|---|---|
| committer | 2016-05-22 23:50:55 +0200 | |
| commit | e39d55a237f116cacc3e686f4bb5449d0449174b (patch) | |
| tree | e2ca8745d9f3ebfda51b8a1c21a045e064f61ddc | |
| parent | [New hoster] HearthisAt - fix #2467 (diff) | |
| download | pyload-e39d55a237f116cacc3e686f4bb5449d0449174b.tar.xz | |
[New hoster] [DatoidCz] fix #665
| -rw-r--r-- | module/plugins/accounts/DatoidCz.py | 43 | ||||
| -rw-r--r-- | module/plugins/hoster/DatoidCz.py | 53 | 
2 files changed, 96 insertions, 0 deletions
| diff --git a/module/plugins/accounts/DatoidCz.py b/module/plugins/accounts/DatoidCz.py new file mode 100644 index 000000000..22cce9d30 --- /dev/null +++ b/module/plugins/accounts/DatoidCz.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.Account import Account + + +class DatoidCz(Account): +    __name__    = "DatoidCz" +    __type__    = "account" +    __version__ = "0.38" +    __status__  = "testing" + +    __description__ = """Datoid.cz account plugin""" +    __license__     = "GPLv3" +    __authors__     = [("GammaC0de", None)] + + +    def grab_info(self, user, password, data): +        html = self.load("https://datoid.cz/") + +        m = re.search(r'"menu-bar-storage"></i> ([\d.,]+) ([\w^_]+)', html) +        trafficleft = self.parse_traffic(m.group(1), m.group(2)) if m else 0 + + +        info = {'validuntil' : -1, +                'trafficleft': trafficleft, +                'premium'    : True} + +        return info + + +    def signin(self, user, password, data): +        html = self.load("https://datoid.cz/") +        if 'href="/muj-ucet">' in html: +            self.skip_login() + +        html = self.load("https://datoid.cz/prihlaseni?do=signInForm-submit", +                         post={'username': user, +                               'password': password}) + +        if 'href="/muj-ucet">' not in html: +            self.fail_login() diff --git a/module/plugins/hoster/DatoidCz.py b/module/plugins/hoster/DatoidCz.py new file mode 100644 index 000000000..364bcfd67 --- /dev/null +++ b/module/plugins/hoster/DatoidCz.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +import time +import urlparse + +from module.plugins.internal.misc import json +from module.plugins.internal.SimpleHoster import SimpleHoster + + +class DatoidCz(SimpleHoster): +    __name__    = "DatoidCz" +    __type__    = "hoster" +    __version__ = "0.01" +    __status__  = "testing" + +    __pattern__ = r'https?://(?:www\.)?datoid\.(?:cz|sk|pl)/(?!slozka)\w{6}' +    __config__  = [("activated"   , "bool", "Activated"                                        , True), +                   ("use_premium" , "bool", "Use premium account if available"                 , True), +                   ("fallback"    , "bool", "Fallback to free download if premium fails"       , True), +                   ("chk_filesize", "bool", "Check file size"                                  , True), +                   ("max_wait"    , "int" , "Reconnect if waiting time is greater than minutes", 10  )] + +    __description__ = """Datoid.cz hoster plugin""" +    __license__     = "GPLv3" +    __authors__     = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] + + +    NAME_PATTERN    = ur'Název souboru: (?P<N>.+)' +    SIZE_PATTERN    =  r'Velikost: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' +    OFFLINE_PATTERN =  r'Tento soubor neexistuje' + +    URL_REPLACEMENTS = [(r'datoid.sk', r'datoid.cz'), +                        (r'datoid.pl', r'datoid.cz')] + + +    def handle_free(self, pyfile): +        url = self.req.lastEffectiveURL +        urlp = urlparse.urlparse(url) + +        json_data = json.loads(self.load(urlparse.urljoin(url, "/f/" + urlp.path + str(int(time.time() * 1000))))) +        self.log_debug(json_data) + +        if "error" in json_data: +            self.fail(json_data['error']) + +        self.link = json_data['redirect'] + + +    def handle_premium(self, pyfile): +        url = self.req.lastEffectiveURL +        urlp = urlparse.urlparse(url) + +        self.link = urlparse.urljoin(url, "/f/" + urlp.path + str(int(time.time() * 1000))) | 
