From 04038a2cf0c4c2d9cc9a0c8e8bf9beb6426afae8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 10 Jul 2014 03:02:26 +0200 Subject: Use parseError instead PluginParseError + unified all download pattern attributes as LINK_PATTERN + removed some old patterns (not used anymore) + other code cosmetics --- module/plugins/hoster/UnibytesCom.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 1a64146c4..a90b75439 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -32,18 +32,20 @@ class UnibytesCom(SimpleHoster): __author_mail__ = "zoidberg@mujmail.cz" FILE_INFO_PATTERN = r']*?id="fileName"[^>]*>(?P[^>]+)\s*\((?P\d.*?)\)' - DOMAIN = 'http://www.unibytes.com' + HOSTER_NAME = "unibytes.com" WAIT_PATTERN = r'Wait for (\d+) sec' - DOWNLOAD_LINK_PATTERN = r'Download' + LINK_PATTERN = r'Download' + def handleFree(self): + domain = "http://www." + self.HOSTER_NAME action, post_data = self.parseHtmlForm('id="startForm"') self.req.http.c.setopt(FOLLOWLOCATION, 0) for _ in xrange(8): self.logDebug(action, post_data) - self.html = self.load(self.DOMAIN + action, post=post_data) + self.html = self.load(domain + action, post=post_data) found = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) if found: @@ -55,7 +57,7 @@ class UnibytesCom(SimpleHoster): self.retry() if post_data['step'] == 'last': - found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if found: url = found.group(1) self.correctCaptcha() @@ -70,7 +72,7 @@ class UnibytesCom(SimpleHoster): found = re.search(self.WAIT_PATTERN, self.html) self.wait(int(found.group(1)) if found else 60, False) elif last_step in ('captcha', 'last'): - post_data['captcha'] = self.decryptCaptcha(self.DOMAIN + '/captcha.jpg') + post_data['captcha'] = self.decryptCaptcha(domain + '/captcha.jpg') else: self.fail("No valid captcha code entered") -- cgit v1.2.3 From 48c0c42fd6faffc56432d5f037cd575979f180cc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 02:23:37 +0200 Subject: Removed all @author flags + key attributes cleanup for internal & hooks plugins --- module/plugins/hoster/UnibytesCom.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index a90b75439..6f0fe36b8 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -13,8 +13,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - - @author: zoidberg """ import re -- cgit v1.2.3 From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/hoster/UnibytesCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 6f0fe36b8..61f254476 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -69,7 +69,7 @@ class UnibytesCom(SimpleHoster): if last_step == 'timer': found = re.search(self.WAIT_PATTERN, self.html) self.wait(int(found.group(1)) if found else 60, False) - elif last_step in ('captcha', 'last'): + elif last_step in ("captcha", "last"): post_data['captcha'] = self.decryptCaptcha(domain + '/captcha.jpg') else: self.fail("No valid captcha code entered") -- cgit v1.2.3 From 9395182da7afed55a29bde1c7cbefe4204e783f0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:02:09 +0200 Subject: Store all re.search/match object as "m" instead "found" --- module/plugins/hoster/UnibytesCom.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 61f254476..50e4c32d0 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -45,9 +45,9 @@ class UnibytesCom(SimpleHoster): self.logDebug(action, post_data) self.html = self.load(domain + action, post=post_data) - found = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) - if found: - url = found.group(1) + m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) + if m: + url = m.group(1) break if '>Somebody else is already downloading using your IP-address<' in self.html: @@ -55,9 +55,9 @@ class UnibytesCom(SimpleHoster): self.retry() if post_data['step'] == 'last': - found = re.search(self.LINK_PATTERN, self.html) - if found: - url = found.group(1) + m = re.search(self.LINK_PATTERN, self.html) + if m: + url = m.group(1) self.correctCaptcha() break else: @@ -67,8 +67,8 @@ class UnibytesCom(SimpleHoster): action, post_data = self.parseHtmlForm('id="stepForm"') if last_step == 'timer': - found = re.search(self.WAIT_PATTERN, self.html) - self.wait(int(found.group(1)) if found else 60, False) + m = re.search(self.WAIT_PATTERN, self.html) + self.wait(int(m.group(1)) if m else 60, False) elif last_step in ("captcha", "last"): post_data['captcha'] = self.decryptCaptcha(domain + '/captcha.jpg') else: -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hoster/UnibytesCom.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 50e4c32d0..e936b84b1 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -1,30 +1,19 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . -""" - import re + from pycurl import FOLLOWLOCATION + from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): __name__ = "UnibytesCom" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?unibytes\.com/[a-zA-Z0-9-._ ]{11}B' __version__ = "0.1" + + __pattern__ = r'http://(?:www\.)?unibytes\.com/[a-zA-Z0-9-._ ]{11}B' + __description__ = """UniBytes.com hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" -- cgit v1.2.3 From 0d220d634e512d89bda540f91c643b361c82ea8a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Sep 2014 01:38:32 +0200 Subject: Logging string cosmetics --- module/plugins/hoster/UnibytesCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index e936b84b1..c490bf879 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -63,7 +63,7 @@ class UnibytesCom(SimpleHoster): else: self.fail("No valid captcha code entered") - self.logDebug('Download link: ' + url) + self.logDebug("Download link: " + url) self.req.http.c.setopt(FOLLOWLOCATION, 1) self.download(url) -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/hoster/UnibytesCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index c490bf879..e00b91d33 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -15,8 +15,8 @@ class UnibytesCom(SimpleHoster): __pattern__ = r'http://(?:www\.)?unibytes\.com/[a-zA-Z0-9-._ ]{11}B' __description__ = """UniBytes.com hoster plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + FILE_INFO_PATTERN = r']*?id="fileName"[^>]*>(?P[^>]+)\s*\((?P\d.*?)\)' -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/hoster/UnibytesCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index e00b91d33..ec6df395c 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -15,6 +15,7 @@ class UnibytesCom(SimpleHoster): __pattern__ = r'http://(?:www\.)?unibytes\.com/[a-zA-Z0-9-._ ]{11}B' __description__ = """UniBytes.com hoster plugin""" + __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] -- cgit v1.2.3 From f76e5c2336718dca9da8033ba22cd83c72c7b3b3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:14:28 +0200 Subject: Pattern update 1 --- module/plugins/hoster/UnibytesCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index ec6df395c..8e732d1fd 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -12,7 +12,7 @@ class UnibytesCom(SimpleHoster): __type__ = "hoster" __version__ = "0.1" - __pattern__ = r'http://(?:www\.)?unibytes\.com/[a-zA-Z0-9-._ ]{11}B' + __pattern__ = r'http://(?:www\.)?unibytes\.com/[\w .-]{11}B' __description__ = """UniBytes.com hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 4da90891eb2544ac15a7d512aba8cb357f68ee5f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 01:11:29 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/UnibytesCom.py | 1 - 1 file changed, 1 deletion(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 8e732d1fd..d2588b95f 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -64,7 +64,6 @@ class UnibytesCom(SimpleHoster): else: self.fail("No valid captcha code entered") - self.logDebug("Download link: " + url) self.req.http.c.setopt(FOLLOWLOCATION, 1) self.download(url) -- cgit v1.2.3 From 1c4bf83881d2a22da3773666a580d51f6b57bfd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 03:07:21 +0200 Subject: Avoid gettext conflict due variable `_` --- module/plugins/hoster/UnibytesCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index d2588b95f..93c7af529 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -31,7 +31,7 @@ class UnibytesCom(SimpleHoster): action, post_data = self.parseHtmlForm('id="startForm"') self.req.http.c.setopt(FOLLOWLOCATION, 0) - for _ in xrange(8): + for _i in xrange(8): self.logDebug(action, post_data) self.html = self.load(domain + action, post=post_data) -- cgit v1.2.3 From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 26 Oct 2014 02:31:54 +0200 Subject: Extend translation support in plugins + a lot of code cosmetics and typo fixes --- module/plugins/hoster/UnibytesCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 93c7af529..eb7ef4c87 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -62,7 +62,7 @@ class UnibytesCom(SimpleHoster): elif last_step in ("captcha", "last"): post_data['captcha'] = self.decryptCaptcha(domain + '/captcha.jpg') else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) self.req.http.c.setopt(FOLLOWLOCATION, 1) self.download(url) -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/hoster/UnibytesCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index eb7ef4c87..abad66579 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -8,15 +8,15 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): - __name__ = "UnibytesCom" - __type__ = "hoster" + __name__ = "UnibytesCom" + __type__ = "hoster" __version__ = "0.1" __pattern__ = r'http://(?:www\.)?unibytes\.com/[\w .-]{11}B' __description__ = """UniBytes.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] FILE_INFO_PATTERN = r']*?id="fileName"[^>]*>(?P[^>]+)\s*\((?P\d.*?)\)' -- cgit v1.2.3 From a372550e6eaf0d0235e68f2d20535123410e121f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 2 Nov 2014 22:46:15 +0100 Subject: [LetitbitNet][Share4webCom][UnibytesCom] https support + use urljoin + update PATTERNs --- module/plugins/hoster/UnibytesCom.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/UnibytesCom.py') diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index abad66579..8c39cce82 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -2,6 +2,8 @@ import re +from urlparse import urljoin + from pycurl import FOLLOWLOCATION from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -10,30 +12,31 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): __name__ = "UnibytesCom" __type__ = "hoster" - __version__ = "0.1" + __version__ = "0.11" - __pattern__ = r'http://(?:www\.)?unibytes\.com/[\w .-]{11}B' + __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B' __description__ = """UniBytes.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = r']*?id="fileName"[^>]*>(?P[^>]+)\s*\((?P\d.*?)\)' + HOSTER_DOMAIN = "unibytes.com" + + INFO_PATTERN = r']*?id="fileName"[^>]*>(?P[^>]+)\s*\((?P\d.*?)\)' - HOSTER_NAME = "unibytes.com" WAIT_PATTERN = r'Wait for (\d+) sec' LINK_PATTERN = r'Download' def handleFree(self): - domain = "http://www." + self.HOSTER_NAME + domain = "http://www.%s/" % self.HOSTER_DOMAIN action, post_data = self.parseHtmlForm('id="startForm"') self.req.http.c.setopt(FOLLOWLOCATION, 0) for _i in xrange(8): self.logDebug(action, post_data) - self.html = self.load(domain + action, post=post_data) + self.html = self.load(urljoin(domain, action), post=post_data) m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) if m: @@ -60,7 +63,7 @@ class UnibytesCom(SimpleHoster): m = re.search(self.WAIT_PATTERN, self.html) self.wait(int(m.group(1)) if m else 60, False) elif last_step in ("captcha", "last"): - post_data['captcha'] = self.decryptCaptcha(domain + '/captcha.jpg') + post_data['captcha'] = self.decryptCaptcha(urljoin(domain, "/captcha.jpg")) else: self.fail(_("No valid captcha code entered")) -- cgit v1.2.3