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