summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/UnrestrictLi.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/UnrestrictLi.py')
-rw-r--r--module/plugins/hoster/UnrestrictLi.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py
index e866a9269..358e493b1 100644
--- a/module/plugins/hoster/UnrestrictLi.py
+++ b/module/plugins/hoster/UnrestrictLi.py
@@ -35,7 +35,7 @@ def secondsToMidnight():
class UnrestrictLi(Hoster):
__name__ = "UnrestrictLi"
- __version__ = "0.03"
+ __version__ = "0.09"
__type__ = "hoster"
__pattern__ = r"https?://.*(unrestrict|unr)\.li"
__description__ = """Unrestrict.li hoster plugin"""
@@ -43,12 +43,12 @@ class UnrestrictLi(Hoster):
__author_mail__ = ("l.stickell@yahoo.it")
def init(self):
- self.chunkLimit = -1
+ self.chunkLimit = 16
self.resumeDownload = True
def process(self, pyfile):
if not self.account:
- self.logError("Please enter your Unrestrict.li account or deactivate this plugin")
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "Unrestrict.li")
self.fail("No Unrestrict.li account provided")
self.logDebug("Old URL: %s" % pyfile.url)
@@ -61,7 +61,12 @@ class UnrestrictLi(Hoster):
self.logDebug("JSON data: " + page)
if page != '':
break
- if "You are not allowed to download from this host" in page:
+ if "File offline" in page:
+ self.offline()
+ elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in page:
+ self.logInfo("Hoster temporarily unavailable, waiting 1 minute and retry")
+ self.retry(5, 60, "Hoster is temporarily unavailable")
+ elif "You are not allowed to download from this host" in page:
self.fail("You are not allowed to download from this host")
elif "You have reached your daily limit for this host" in page:
self.logInfo("Reached daily limit for this host. Waiting until 00:10 GMT+2")
@@ -72,8 +77,17 @@ class UnrestrictLi(Hoster):
self.logDebug("New URL: " + new_url)
+ if hasattr(self, 'api_data'):
+ self.setNameSize()
+
self.download(new_url, disposition=True)
if self.getConfig("history"):
self.load("https://unrestrict.li/history/&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']