diff options
| author | 2015-05-09 22:27:11 +0200 | |
|---|---|---|
| committer | 2015-05-09 22:27:11 +0200 | |
| commit | d5cee0bbabfd60e020cd2cd9248c41b913e438c3 (patch) | |
| tree | 4b5535018cd2b451869760e2cf210ece70f3ba0c /module | |
| parent | Merge pull request #1405 from GammaC0de/GammaC0de-ClickAndLoad-SSL (diff) | |
| download | pyload-d5cee0bbabfd60e020cd2cd9248c41b913e438c3.tar.xz | |
[UnrestrictLi] Mark as dead
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/accounts/UnrestrictLi.py | 44 | ||||
| -rw-r--r-- | module/plugins/hooks/UnrestrictLiHook.py | 28 | ||||
| -rw-r--r-- | module/plugins/hoster/UnrestrictLi.py | 74 | 
3 files changed, 3 insertions, 143 deletions
| diff --git a/module/plugins/accounts/UnrestrictLi.py b/module/plugins/accounts/UnrestrictLi.py deleted file mode 100644 index 6a8187234..000000000 --- a/module/plugins/accounts/UnrestrictLi.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.Account import Account -from module.common.json_layer import json_loads - - -class UnrestrictLi(Account): -    __name__    = "UnrestrictLi" -    __type__    = "account" -    __version__ = "0.05" - -    __description__ = """Unrestrict.li account plugin""" -    __license__     = "GPLv3" -    __authors__     = [("stickell", "l.stickell@yahoo.it")] - - -    def loadAccountInfo(self, user, req): -        json_data = req.load('http://unrestrict.li/api/jdownloader/user.php?format=json') -        self.logDebug("JSON data: " + json_data) -        json_data = json_loads(json_data) - -        if 'vip' in json_data['result'] and json_data['result']['vip'] == 0: -            return {"premium": False} - -        validuntil = json_data['result']['expires'] -        trafficleft = float(json_data['result']['traffic'] / 1024)  #@TODO: Remove `/ 1024` in 0.4.10 - -        return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - - -    def login(self, user, data, req): -        req.cj.setCookie("unrestrict.li", "lang", "EN") -        html = req.load("https://unrestrict.li/sign_in", decode=True) - -        if 'solvemedia' in html: -            self.logError(_("A Captcha is required. Go to http://unrestrict.li/sign_in and login, then retry")) -            return - -        post_data = {"username": user, "password": data['password'], -                     "remember_me": "remember", "signin": "Sign in"} -        html = req.load("https://unrestrict.li/sign_in", post=post_data, decode=True) - -        if 'sign_out' not in html: -            self.wrongPassword() diff --git a/module/plugins/hooks/UnrestrictLiHook.py b/module/plugins/hooks/UnrestrictLiHook.py deleted file mode 100644 index f1ffd1886..000000000 --- a/module/plugins/hooks/UnrestrictLiHook.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class UnrestrictLiHook(MultiHook): -    __name__    = "UnrestrictLiHook" -    __type__    = "hook" -    __version__ = "0.05" - -    __config__ = [("pluginmode"    , "all;listed;unlisted", "Use for plugins"                     , "all"), -                  ("pluginlist"    , "str"                , "Plugin list (comma separated)"       , ""   ), -                  ("revertfailed"  , "bool"               , "Revert to standard download if fails", True ), -                  ("reload"        , "bool"               , "Reload plugin list"                  , True ), -                  ("reloadinterval", "int"                , "Reload interval in hours"            , 12   ), -                  ("history"       , "bool"               , "Delete History"                      , False)] - -    __description__ = """Unrestrict.li hook plugin""" -    __license__     = "GPLv3" -    __authors__     = [("stickell", "l.stickell@yahoo.it")] - - -    def getHosters(self): -        json_data = self.getURL("http://unrestrict.li/api/jdownloader/hosts.php", get={'format': "json"}) -        json_data = json_loads(json_data) - -        return [element['host'] for element in json_data['result']] diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py index dab5abd44..d3854db31 100644 --- a/module/plugins/hoster/UnrestrictLi.py +++ b/module/plugins/hoster/UnrestrictLi.py @@ -1,86 +1,18 @@  # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.SimpleHoster import secondsToMidnight - -class UnrestrictLi(MultiHoster): +class UnrestrictLi(DeadHoster):      __name__    = "UnrestrictLi"      __type__    = "hoster" -    __version__ = "0.22" +    __version__ = "0.23"      __pattern__ = r'https?://(?:www\.)?(unrestrict|unr)\.li/dl/[\w^_]+' -    __config__  = [("use_premium", "bool", "Use premium account if available", True)]      __description__ = """Unrestrict.li multi-hoster plugin"""      __license__     = "GPLv3"      __authors__     = [("stickell", "l.stickell@yahoo.it")] -    LOGIN_ACCOUNT = False - - -    def setup(self): -        self.chunkLimit     = 16 -        self.resumeDownload = True - - -    def handleFree(self, pyfile): -        for _i in xrange(5): -            self.html = self.load('https://unrestrict.li/unrestrict.php', -                             post={'link': pyfile.url, 'domain': 'long'}) - -            self.logDebug("JSON data: " + self.html) - -            if self.html: -                break -        else: -            self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) -            self.retry(5, 60, "Unable to get API data") - -        if 'Expired session' in self.html \ -           or ("You are not allowed to download from this host" in self.html and self.premium): -            self.account.relogin(self.user) -            self.retry() - -        elif "File offline" in self.html: -            self.offline() - -        elif "You are not allowed to download from this host" in self.html: -            self.fail(_("You are not allowed to download from this host")) - -        elif "You have reached your daily limit for this host" in self.html: -            self.logWarning(_("Reached daily limit for this host")) -            self.retry(5, secondsToMidnight(gmt=2), "Daily limit for this host reached") - -        elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in self.html: -            self.logInfo(_("Hoster temporarily unavailable, waiting 1 minute and retry")) -            self.retry(5, 60, "Hoster is temporarily unavailable") - -        self.html     = json_loads(self.html) -        self.link     = self.html.keys()[0] -        self.api_data = self.html[self.link] - -        if hasattr(self, 'api_data'): -            self.setNameSize() - - -    def checkFile(self, rules={}): -        super(UnrestrictLi, self).checkFile(rules) - -        if self.getConfig('history'): -            self.load("https://unrestrict.li/history/", get={'delete': "all"}) -            self.logInfo(_("Download history deleted")) - - -    def setNameSize(self): -        if 'name' in self.api_data: -            self.pyfile.name = self.api_data['name'] -        if 'size' in self.api_data: -            self.pyfile.size = self.api_data['size'] - -  getInfo = create_getInfo(UnrestrictLi) | 
