From b3c5ce5dadf086b99c524bf454fb979733243da0 Mon Sep 17 00:00:00 2001 From: Stefano Date: Wed, 9 Jul 2014 12:35:08 +0200 Subject: [Lomafile] new hoster --- module/plugins/hoster/LomafileCom.py | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 module/plugins/hoster/LomafileCom.py (limited to 'module/plugins/hoster/LomafileCom.py') diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py new file mode 100644 index 000000000..5ce41264b --- /dev/null +++ b/module/plugins/hoster/LomafileCom.py @@ -0,0 +1,55 @@ +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class LomafileCom(SimpleHoster): + __name__ = "LomafileCom" + __type__ = "hoster" + __pattern__ = r'https?://lomafile\.com/.+/[\w\.]+' + __version__ = "0.1" + __description__ = """Lomafile.com hoster plugin""" + __author_name__ = "nath_schwarz" + __author_mail__ = "nathan.notwhite@gmail.com" + + FILE_NAME_PATTERN = r'Filename:[^>]*>(?P[\w\.]+)' + FILE_SIZE_PATTERN = r'\((?P\d+)\s(?P\w+)\)' + FILE_OFFLINE_PATTERN = r'Software error' + + def handleFree(self): + for _ in range(3): + captcha_id = re.search(r'src="http://lomafile\.com/captchas/(?P\w+)\.jpg"', self.html) + if not captcha_id: + self.parseError("Unable to parse captcha id.") + else: + captcha_id = captcha_id.group("id") + + form_id = re.search(r'name="id" value="(?P\w+)"', self.html) + if not form_id: + self.parseError("Unable to parse form id") + else: + form_id = form_id.group("id") + + captcha = self.decryptCaptcha("http://lomafile.com/captchas/" + captcha_id + ".jpg") + + self.wait(60) + + self.html = self.load(self.pyfile.url, post={ + "op": "download2", + "id": form_id, + "rand": captcha_id, + "code": captcha, + "down_direct": "1"}) + + download_url = re.search(r'http://[\d\.]+:\d+/d/\w+/[\w\.]+', self.html) + if not download_url: + self.invalidCaptcha() + self.logDebug("Invalid captcha.") + else: + download_url = download_url.group(0) + self.logDebug("Download URL: %s" % download_url) + self.download(download_url) + else: + self.fail("Invalid captcha-code entered.") + +getInfo = create_getInfo(LomafileCom) -- cgit v1.2.3 From 05d258d98dd8c2faf0b769840fa1e3c4acccdce8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:25:14 +0200 Subject: Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 --- module/plugins/hoster/LomafileCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/LomafileCom.py') diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py index 5ce41264b..9f05d952e 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -42,7 +42,7 @@ class LomafileCom(SimpleHoster): "down_direct": "1"}) download_url = re.search(r'http://[\d\.]+:\d+/d/\w+/[\w\.]+', self.html) - if not download_url: + if download_url is None: self.invalidCaptcha() self.logDebug("Invalid captcha.") 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/LomafileCom.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/LomafileCom.py') diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py index 9f05d952e..98b89a732 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -6,8 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LomafileCom(SimpleHoster): __name__ = "LomafileCom" __type__ = "hoster" - __pattern__ = r'https?://lomafile\.com/.+/[\w\.]+' __version__ = "0.1" + + __pattern__ = r'https?://lomafile\.com/.+/[\w\.]+' + __description__ = """Lomafile.com hoster plugin""" __author_name__ = "nath_schwarz" __author_mail__ = "nathan.notwhite@gmail.com" @@ -16,6 +20,7 @@ class LomafileCom(SimpleHoster): FILE_SIZE_PATTERN = r'\((?P\d+)\s(?P\w+)\)' FILE_OFFLINE_PATTERN = r'Software error' + def handleFree(self): for _ in range(3): captcha_id = re.search(r'src="http://lomafile\.com/captchas/(?P\w+)\.jpg"', self.html) -- cgit v1.2.3 From a2b1a203a7666052d4857620b4712e82160747c2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 4 Sep 2014 22:29:59 +0200 Subject: [SimpleHoster] Improve parseFileInfo --- module/plugins/hoster/LomafileCom.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/LomafileCom.py') diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py index 98b89a732..372d42fd3 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -8,17 +8,17 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LomafileCom(SimpleHoster): __name__ = "LomafileCom" __type__ = "hoster" - __version__ = "0.1" + __version__ = "0.2" __pattern__ = r'https?://lomafile\.com/.+/[\w\.]+' - __description__ = """Lomafile.com hoster plugin""" + __description__ = """ Lomafile.com hoster plugin """ __author_name__ = "nath_schwarz" __author_mail__ = "nathan.notwhite@gmail.com" FILE_NAME_PATTERN = r'Filename:[^>]*>(?P[\w\.]+)' FILE_SIZE_PATTERN = r'\((?P\d+)\s(?P\w+)\)' - FILE_OFFLINE_PATTERN = r'Software error' + OFFLINE_PATTERN = r'Software error' def handleFree(self): @@ -57,4 +57,5 @@ class LomafileCom(SimpleHoster): else: self.fail("Invalid captcha-code entered.") + getInfo = create_getInfo(LomafileCom) -- cgit v1.2.3