diff options
Diffstat (limited to 'pyload/plugins/hoster/MultiDebridCom.py')
-rw-r--r-- | pyload/plugins/hoster/MultiDebridCom.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/pyload/plugins/hoster/MultiDebridCom.py b/pyload/plugins/hoster/MultiDebridCom.py new file mode 100644 index 000000000..765022eef --- /dev/null +++ b/pyload/plugins/hoster/MultiDebridCom.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.common.json_layer import json_loads +from pyload.plugins.Hoster import Hoster + + +class MultiDebridCom(Hoster): + __name__ = "MultiDebridCom" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'http://(?:www\.)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' + + __description__ = """Multi-debrid.com hoster plugin""" + __author_name__ = "stickell" + __author_mail__ = "l.stickell@yahoo.it" + + + def setup(self): + self.chunkLimit = -1 + self.resumeDownload = True + + def process(self, pyfile): + if re.match(self.__pattern__, pyfile.url): + new_url = pyfile.url + elif not self.account: + self.logError(_("Please enter your %s account or deactivate this plugin") % "Multi-debrid.com") + self.fail("No Multi-debrid.com account provided") + else: + self.logDebug("Original URL: %s" % pyfile.url) + page = self.req.load('http://multi-debrid.com/api.php', + get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], + 'link': pyfile.url}) + self.logDebug("JSON data: " + page) + page = json_loads(page) + if page['status'] != 'ok': + self.fail('Unable to unrestrict link') + new_url = page['link'] + + if new_url != pyfile.url: + self.logDebug("Unrestricted URL: " + new_url) + + self.download(new_url, disposition=True) |