From 04302ed62dda2bec2d0e6f3ead95029fab9c8568 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 22 Dec 2014 22:30:46 +0100 Subject: New plugin: CloudzillaTo --- module/plugins/hoster/CloudzillaTo.py | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 module/plugins/hoster/CloudzillaTo.py (limited to 'module/plugins/hoster/CloudzillaTo.py') 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[\w^_]+)' + + __description__ = """Cloudzilla.to hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + INFO_PATTERN = r'>(?P.+?) \((?P[\d.]+) (?P[\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) -- cgit v1.2.3 From b10b1cefdb87a3544a9a0f9fc27ee2fa1ee3cbed Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 22 Dec 2014 22:34:16 +0100 Subject: [CloudzillaTo] Typo --- module/plugins/hoster/CloudzillaTo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/CloudzillaTo.py') diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index def253281..2e98842a6 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P[\w^_]+)' @@ -37,7 +37,7 @@ class CloudzillaTo(SimpleHoster): def handlePremium(self): - return handleFree(self): + return self.handleFree() getInfo = create_getInfo(CloudzillaTo) -- cgit v1.2.3 From 142aee553f077798295656ac597945abdecb4e40 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 13:57:57 +0100 Subject: [CloudzillaTo] Fixup --- module/plugins/hoster/CloudzillaTo.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'module/plugins/hoster/CloudzillaTo.py') diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 2e98842a6..62391e5c7 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -1,13 +1,14 @@ # -*- coding: utf-8 -*- +import re + 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.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P[\w^_]+)' @@ -16,24 +17,27 @@ class CloudzillaTo(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - INFO_PATTERN = r'>(?P.+?) \((?P[\d.]+) (?P[\w^_]+)' + INFO_PATTERN = r'title="(?P.+?)">\1 \((?P[\d.]+) (?P[\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'] + self.html = self.load("http://www.cloudzilla.to/generateticket/", + post={'file_id': self.info['pattern']['ID'], 'key': self.getPassword()}) + + ticket = dict(re.findall(r'<(.+?)>([^<>]+?) 5) + self.wait(int(ticket['wait']), int(ticket['wait']) > 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']}) + self.link = "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): -- cgit v1.2.3 From 1532521dda9dda1656700ea78d14a113ea277412 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 17:21:44 +0100 Subject: [CloudzillaTo] Password support --- module/plugins/hoster/CloudzillaTo.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/CloudzillaTo.py') diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 62391e5c7..442b0dd6c 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P[\w^_]+)' @@ -20,6 +20,17 @@ class CloudzillaTo(SimpleHoster): INFO_PATTERN = r'title="(?P.+?)">\1 \((?P[\d.]+) (?P[\w^_]+)' OFFLINE_PATTERN = r'>File not found...<' + PASSWORD_PATTERN = r'
' + + + def checkErrors(self): + m = re.search(self.PASSWORD_PATTERN, self.html) + if m: + self.html = self.load(self.pyfile.url, get={'key': self.getPassword()}) + + if re.search(self.PASSWORD_PATTERN, self.html): + self.retry(reason="Wrong password") + def handleFree(self): self.html = self.load("http://www.cloudzilla.to/generateticket/", @@ -30,7 +41,10 @@ class CloudzillaTo(SimpleHoster): self.logDebug(ticket) if 'error' in ticket: - self.fail(ticket['error']) + if "File is password protected" in ticket['error']: + self.retry(reason="Wrong password") + else: + self.fail(ticket['error']) if 'wait' in ticket: self.wait(int(ticket['wait']), int(ticket['wait']) > 5) -- cgit v1.2.3 From 6b60af3d42fb3e5b68826ca370e39fc50b4d584f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:22:34 +0100 Subject: [CloudzillaTo] Fixup --- module/plugins/hoster/CloudzillaTo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/CloudzillaTo.py') diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 442b0dd6c..d8b5e8b5d 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P[\w^_]+)' @@ -51,7 +51,7 @@ class CloudzillaTo(SimpleHoster): self.link = "http://%(server)s/download/%(file_id)s/%(ticket_id)s" % {'server' : ticket['server'], 'file_id' : self.info['pattern']['ID'], - 'ticket_id': ticket['ticket_id']}) + 'ticket_id': ticket['ticket_id']} def handlePremium(self): -- cgit v1.2.3 From fd105f8e51768ec1943cda2375bdfdbe5b0a3951 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 9 Jan 2015 00:35:51 +0100 Subject: "New Year" Update: hoster plugins --- module/plugins/hoster/CloudzillaTo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/CloudzillaTo.py') diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index d8b5e8b5d..58b1ac0dd 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P[\w^_]+)' @@ -32,7 +32,7 @@ class CloudzillaTo(SimpleHoster): self.retry(reason="Wrong password") - def handleFree(self): + def handleFree(self, pyfile): self.html = self.load("http://www.cloudzilla.to/generateticket/", post={'file_id': self.info['pattern']['ID'], 'key': self.getPassword()}) @@ -54,8 +54,8 @@ class CloudzillaTo(SimpleHoster): 'ticket_id': ticket['ticket_id']} - def handlePremium(self): - return self.handleFree() + def handlePremium(self, pyfile): + return self.handleFree(pyfile) getInfo = create_getInfo(CloudzillaTo) -- cgit v1.2.3 From e9eb993cb369aef09741917370f2518168465f8c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 28 Jan 2015 01:34:38 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/CloudzillaTo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/CloudzillaTo.py') diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 58b1ac0dd..ee966c280 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -47,7 +47,7 @@ class CloudzillaTo(SimpleHoster): self.fail(ticket['error']) if 'wait' in ticket: - self.wait(int(ticket['wait']), int(ticket['wait']) > 5) + self.wait(ticket['wait'], int(ticket['wait']) > 5) self.link = "http://%(server)s/download/%(file_id)s/%(ticket_id)s" % {'server' : ticket['server'], 'file_id' : self.info['pattern']['ID'], -- cgit v1.2.3