diff options
Diffstat (limited to 'module/plugins/hoster/MyfastfileCom.py')
-rw-r--r-- | module/plugins/hoster/MyfastfileCom.py | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index b67b221d2..3862bfe32 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -2,18 +2,18 @@ import re -from pyload.plugin.Hoster import Hoster -from pyload.utils import json_loads +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class MyfastfileCom(Hoster): +class MyfastfileCom(MultiHoster): __name__ = "MyfastfileCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.08" - __pattern__ = r'http://(?:www\.)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' + __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' - __description__ = """Myfastfile.com hoster plugin""" + __description__ = """Myfastfile.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] @@ -21,27 +21,19 @@ class MyfastfileCom(Hoster): 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") % "Myfastfile.com") - self.fail(_("No Myfastfile.com account provided")) - else: - self.logDebug("Original URL: %s" % pyfile.url) - page = self.load('http://myfastfile.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) + + + def handlePremium(self, pyfile): + self.html = self.load('http://myfastfile.com/api.php', + get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], + 'link': pyfile.url}) + self.logDebug("JSON data: " + self.html) + + self.html = json_loads(self.html) + if self.html['status'] != 'ok': + self.fail(_("Unable to unrestrict link")) + + self.link = self.html['link'] + + +getInfo = create_getInfo(MyfastfileCom) |