diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-22 22:30:46 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-22 22:30:46 +0100 |
commit | 04302ed62dda2bec2d0e6f3ead95029fab9c8568 (patch) | |
tree | ed4c2d14f70294da8debf543bf86ff5ea7b121db /module/plugins | |
parent | [XFileSharingPro] Support salefiles.com (diff) | |
download | pyload-04302ed62dda2bec2d0e6f3ead95029fab9c8568.tar.xz |
New plugin: CloudzillaTo
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/CloudzillaTo.py | 36 | ||||
-rw-r--r-- | module/plugins/hoster/CloudzillaTo.py | 43 |
2 files changed, 79 insertions, 0 deletions
diff --git a/module/plugins/accounts/CloudzillaTo.py b/module/plugins/accounts/CloudzillaTo.py new file mode 100644 index 000000000..f0676f42f --- /dev/null +++ b/module/plugins/accounts/CloudzillaTo.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Account import Account + + +class CloudzillaTo(Account): + __name__ = "CloudzillaTo" + __type__ = "account" + __version__ = "0.01" + + __description__ = """Cloudzilla.to account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + PREMIUM_PATTERN = r'<h2>account type</h2>\s*Premium Account' + + + def loadAccountInfo(self, user, req): + html = req.load("http://www.cloudzilla.to/") + + premium = True if re.search(self.PREMIUM_PATTERN, html) else False + + return {'validuntil': -1, 'trafficleft': -1, 'premium': premium} + + + def login(self, user, data, req): + html = req.load("http://www.cloudzilla.to/", + post={'lusername': user, + 'lpassword': data['password'], + 'w' : "dologin"}) + + if "ERROR" in html: + self.wrongPassword() diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py new file mode 100644 index 000000000..def253281 --- /dev/null +++ b/module/plugins/hoster/CloudzillaTo.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.common.json_layer import json_loads + + +class CloudzillaTo(SimpleHoster): + __name__ = "CloudzillaTo" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P<ID>[\w^_]+)' + + __description__ = """Cloudzilla.to hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + INFO_PATTERN = r'>(?P<N>.+?)</span> <span class="size">\((?P<S>[\d.]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>File not found...<' + + + def handleFree(self): + ticket = json_loads(self.load("http://www.cloudzilla.to/generateticket/", + post={'file_id': self.info['pattern']['ID'], 'key': ""}))['result'] + + if ticket['status'] is "error": + self.fail(ticket['status']['error']) + + if 'wait' in ticket: + wait_time = int(ticket['wait']) + self.wait(wait_time, wait_time > 5) + + self.download("http://%(server)s/download/%(file_id)s/%(ticket_id)s" % {'server' : ticket['server'], + 'file_id' : self.info['pattern']['ID'], + 'ticket_id': ticket['ticket_id']}) + + + def handlePremium(self): + return handleFree(self): + + +getInfo = create_getInfo(CloudzillaTo) |