From 93592862b520a862c01f80c019e5c4bc43746c19 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 5 Jul 2014 16:54:20 +0200 Subject: [SimpleHoster] Better inline docs + changed "FILE_OFFLINE_PATTERN" to "OFFLINE_PATTERN" --- module/plugins/hoster/MegasharesCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index b73b4943c..5168b177d 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -40,7 +40,7 @@ class MegasharesCom(SimpleHoster): REACTIVATE_PASSPORT_PATTERN = r']*id="passport_num" value="(\w+)" />' REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";' NO_SLOTS_PATTERN = r'
All download slots for this link are currently filled' - FILE_OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted)' + OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted)' def setup(self): self.resumeDownload = True -- cgit v1.2.3 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/MegasharesCom.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 5168b177d..ac2752daa 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -31,16 +31,18 @@ class MegasharesCom(SimpleHoster): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - FILE_NAME_PATTERN = '

]*title="(?P[^"]+)">' - FILE_SIZE_PATTERN = 'Filesize: (?P[0-9.]+) (?P[kKMG])i?B
' - DOWNLOAD_URL_PATTERN = r'
]*>\s*' + FILE_NAME_PATTERN = r'

]*title="(?P[^"]+)">' + FILE_SIZE_PATTERN = r'Filesize: (?P[0-9.]+) (?P[kKMG])i?B
' + OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted)' + + LINK_PATTERN = r'
All download slots for this link are currently filled' - OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted)' + def setup(self): self.resumeDownload = True @@ -102,7 +104,7 @@ class MegasharesCom(SimpleHoster): def handleDownload(self, premium=False): # Find download link; - found = re.search(self.DOWNLOAD_URL_PATTERN % (1 if premium else 2), self.html) + found = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) msg = '%s download URL' % ('Premium' if premium else 'Free') if not found: self.parseError(msg) -- 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/MegasharesCom.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index ac2752daa..3284865ce 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.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/MegasharesCom.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 3284865ce..2fde7c0d3 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -56,7 +56,8 @@ class MegasharesCom(SimpleHoster): self.retry(wait_time=5 * 60) self.getFileInfo() - #if self.pyfile.size > 576716800: self.fail("This file is too large for free download") + # if self.pyfile.size > 576716800: + # self.fail("This file is too large for free download") # Reactivate passport if needed found = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) -- 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/MegasharesCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 2fde7c0d3..e4d9aff8b 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -88,7 +88,7 @@ class MegasharesCom(SimpleHoster): # Check traffic left on passport found = re.search(self.PASSPORT_LEFT_PATTERN, self.html) - if not found: + if found is None: self.fail('Passport not found') self.logInfo("Download passport: %s" % found.group(1)) data_left = float(found.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[found.group(3)] @@ -105,7 +105,7 @@ class MegasharesCom(SimpleHoster): # Find download link; found = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) msg = '%s download URL' % ('Premium' if premium else 'Free') - if not found: + if found is None: self.parseError(msg) download_url = found.group(1) -- 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/MegasharesCom.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index e4d9aff8b..f8fa338f3 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -60,9 +60,9 @@ class MegasharesCom(SimpleHoster): # self.fail("This file is too large for free download") # Reactivate passport if needed - found = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) - if found: - passport_num = found.group(1) + m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) + if m: + passport_num = m.group(1) request_uri = re.search(self.REQUEST_URI_PATTERN, self.html).group(1) for _ in xrange(5): @@ -87,28 +87,28 @@ class MegasharesCom(SimpleHoster): self.fail("Failed to reactivate passport") # Check traffic left on passport - found = re.search(self.PASSPORT_LEFT_PATTERN, self.html) - if found is None: + m = re.search(self.PASSPORT_LEFT_PATTERN, self.html) + if m is None: self.fail('Passport not found') - self.logInfo("Download passport: %s" % found.group(1)) - data_left = float(found.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[found.group(3)] - self.logInfo("Data left: %s %s (%d MB needed)" % (found.group(2), found.group(3), self.pyfile.size / 1048576)) + self.logInfo("Download passport: %s" % m.group(1)) + data_left = float(m.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] + self.logInfo("Data left: %s %s (%d MB needed)" % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: - found = re.search(self.PASSPORT_RENEW_PATTERN, self.html) - renew = found.group(1) + found.group(2) + found.group(3) * 60 * 60 if found else 10 * 60 + m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) + renew = m.group(1) + m.group(2) + m.group(3) * 60 * 60 if m else 10 * 60 self.retry(max_tries=15, wait_time=renew, reason="Unable to get passport") self.handleDownload(False) def handleDownload(self, premium=False): # Find download link; - found = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) + m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) msg = '%s download URL' % ('Premium' if premium else 'Free') - if found is None: + if m is None: self.parseError(msg) - download_url = found.group(1) + download_url = m.group(1) self.logDebug("%s: %s" % (msg, download_url)) self.download(download_url) -- 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/MegasharesCom.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index f8fa338f3..c12897ed0 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.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 time import time + from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?megashares.com/.*' __version__ = "0.24" + + __pattern__ = r'http://(?:www\.)?megashares.com/.*' + __description__ = """Megashares.com hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" -- cgit v1.2.3 From 4fd7c36b3d0cda16fb68baa378169ad8094ba62e Mon Sep 17 00:00:00 2001 From: igel-kun Date: Sun, 5 Oct 2014 17:32:38 +0200 Subject: [MegasharesCom] Update patterns --- module/plugins/hoster/MegasharesCom.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index c12897ed0..3b6f29536 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -10,21 +10,23 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" - __pattern__ = r'http://(?:www\.)?megashares.com/.*' + __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index.php)?\?d\d{2}=|dl/)\w+' __description__ = """Megashares.com hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" + FILE_NAME_PATTERN = r'

]*title="(?P[^"]+)">' - FILE_SIZE_PATTERN = r'Filesize: (?P[0-9.]+) (?P[kKMG])i?B
' - OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted)' + FILE_SIZE_PATTERN = r'Filesize: (?P[\d.]+) (?P\w+)' + OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted|Invalid link)' LINK_PATTERN = r'
]*>\s*' - PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*\s*You have\s*<[^>]*>\s*([0-9.]+) ([kKMG]i?B)' - PASSPORT_RENEW_PATTERN = r'Your download passport will renew in\s*(\d+):(\d+):(\d+)' + + PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*?You have.*?<[^>]*>.*?([\d.]+) (\w+)' + PASSPORT_RENEW_PATTERN = r'Your download passport will renew(?:.|\n)*?(\d+).*?(\d+).*?(\d+)' REACTIVATE_NUM_PATTERN = r']*id="random_num" value="(\d+)" />' REACTIVATE_PASSPORT_PATTERN = r']*id="passport_num" value="(\w+)" />' REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";' @@ -35,9 +37,11 @@ class MegasharesCom(SimpleHoster): self.resumeDownload = True self.multiDL = self.premium + def handlePremium(self): self.handleDownload(True) + def handleFree(self): self.html = self.load(self.pyfile.url, decode=True) @@ -45,10 +49,7 @@ class MegasharesCom(SimpleHoster): self.retry(wait_time=5 * 60) self.getFileInfo() - # if self.pyfile.size > 576716800: - # self.fail("This file is too large for free download") - # Reactivate passport if needed m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) if m: passport_num = m.group(1) @@ -76,20 +77,22 @@ class MegasharesCom(SimpleHoster): self.fail("Failed to reactivate passport") # Check traffic left on passport - m = re.search(self.PASSPORT_LEFT_PATTERN, self.html) + m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) if m is None: self.fail('Passport not found') self.logInfo("Download passport: %s" % m.group(1)) - data_left = float(m.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] + data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] self.logInfo("Data left: %s %s (%d MB needed)" % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) - renew = m.group(1) + m.group(2) + m.group(3) * 60 * 60 if m else 10 * 60 - self.retry(max_tries=15, wait_time=renew, reason="Unable to get passport") + renew = int(m.group(1) + 60 * (m.group(2) + 60 * m.group(3))) if found else 600 + self.logDebug('Waiting %d seconds for a new passport' % renew) + self.retry(wait_time=renew, reason="Passport renewal") self.handleDownload(False) + def handleDownload(self, premium=False): # Find download link; m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) -- 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/MegasharesCom.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 3b6f29536..e8fe85d22 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -15,8 +15,7 @@ class MegasharesCom(SimpleHoster): __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index.php)?\?d\d{2}=|dl/)\w+' __description__ = """Megashares.com hoster plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] FILE_NAME_PATTERN = r'

]*title="(?P[^"]+)">' -- 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/MegasharesCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index e8fe85d22..e7ac1d250 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -15,6 +15,7 @@ class MegasharesCom(SimpleHoster): __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index.php)?\?d\d{2}=|dl/)\w+' __description__ = """Megashares.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/MegasharesCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index e7ac1d250..985c77dd5 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -26,7 +26,7 @@ class MegasharesCom(SimpleHoster): LINK_PATTERN = r'
]*>\s*' PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*?You have.*?<[^>]*>.*?([\d.]+) (\w+)' - PASSPORT_RENEW_PATTERN = r'Your download passport will renew(?:.|\n)*?(\d+).*?(\d+).*?(\d+)' + PASSPORT_RENEW_PATTERN = r'Your download passport will renew(?:.|\n)*(\d+).*?(\d+).*?(\d+)' REACTIVATE_NUM_PATTERN = r']*id="random_num" value="(\d+)" />' REACTIVATE_PASSPORT_PATTERN = r']*id="passport_num" value="(\w+)" />' REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";' -- cgit v1.2.3 From c5d1a4fd8943877c6d2eb3843e0de725dba5191e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:09:53 +0200 Subject: Pattern update 2 --- module/plugins/hoster/MegasharesCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 985c77dd5..799c8f5e0 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -12,7 +12,7 @@ class MegasharesCom(SimpleHoster): __type__ = "hoster" __version__ = "0.25" - __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index.php)?\?d\d{2}=|dl/)\w+' + __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' __description__ = """Megashares.com hoster plugin""" __license__ = "GPLv3" @@ -20,7 +20,7 @@ class MegasharesCom(SimpleHoster): FILE_NAME_PATTERN = r'

]*title="(?P[^"]+)">' - FILE_SIZE_PATTERN = r'Filesize: (?P[\d.]+) (?P\w+)' + FILE_SIZE_PATTERN = r'Filesize: (?P[\d.,]+) (?P\w+)' OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted|Invalid link)' LINK_PATTERN = r'
]*>\s*' -- cgit v1.2.3 From 388a2f6478d42e423f1f8442d8539983f3762f22 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 14 Oct 2014 13:38:49 +0200 Subject: Improve unit detection in size pattern --- module/plugins/hoster/MegasharesCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 799c8f5e0..2a7d4659d 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -20,7 +20,7 @@ class MegasharesCom(SimpleHoster): FILE_NAME_PATTERN = r'

]*title="(?P[^"]+)">' - FILE_SIZE_PATTERN = r'Filesize: (?P[\d.,]+) (?P\w+)' + FILE_SIZE_PATTERN = r'Filesize: (?P[\d.,]+) (?P[\w^_]+)' OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted|Invalid link)' LINK_PATTERN = r'
]*>\s*' -- cgit v1.2.3 From 2ae91b81a2f12a1c9b1f78524df78a2b3f1ef494 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Oct 2014 14:52:42 +0200 Subject: Update hosters to self.error --- module/plugins/hoster/MegasharesCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 2a7d4659d..19942f136 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' @@ -98,7 +98,7 @@ class MegasharesCom(SimpleHoster): m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) msg = '%s download URL' % ('Premium' if premium else 'Free') if m is None: - self.parseError(msg) + self.error(msg) download_url = m.group(1) self.logDebug("%s: %s" % (msg, download_url)) -- cgit v1.2.3 From df18c546f35f642bd03ee33c4e8405b4af71f714 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 20 Oct 2014 13:00:16 +0200 Subject: [MegasharesCom] Fix PASSPORT_RENEW_PATTERN --- module/plugins/hoster/MegasharesCom.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 19942f136..61a314de4 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -10,13 +10,14 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' __description__ = """Megashares.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] FILE_NAME_PATTERN = r'

]*title="(?P[^"]+)">' @@ -26,7 +27,7 @@ class MegasharesCom(SimpleHoster): LINK_PATTERN = r'
]*>\s*' PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*?You have.*?<[^>]*>.*?([\d.]+) (\w+)' - PASSPORT_RENEW_PATTERN = r'Your download passport will renew(?:.|\n)*(\d+).*?(\d+).*?(\d+)' + PASSPORT_RENEW_PATTERN = r'(\d+):(\d+):(\d+)' REACTIVATE_NUM_PATTERN = r']*id="random_num" value="(\d+)" />' REACTIVATE_PASSPORT_PATTERN = r']*id="passport_num" value="(\w+)" />' REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";' @@ -43,8 +44,6 @@ class MegasharesCom(SimpleHoster): def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) - if self.NO_SLOTS_PATTERN in self.html: self.retry(wait_time=5 * 60) @@ -76,19 +75,24 @@ class MegasharesCom(SimpleHoster): else: self.fail("Failed to reactivate passport") + m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) + if m: + time = [int(x) for x in m.groups()] + renew = time[0] + (time[1] * 60) + (time[2] * 60) + self.logDebug('Waiting %d seconds for a new passport' % renew) + self.retry(wait_time=renew, reason="Passport renewal") + # Check traffic left on passport m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) if m is None: self.fail('Passport not found') + self.logInfo("Download passport: %s" % m.group(1)) data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] self.logInfo("Data left: %s %s (%d MB needed)" % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: - m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) - renew = int(m.group(1) + 60 * (m.group(2) + 60 * m.group(3))) if found else 600 - self.logDebug('Waiting %d seconds for a new passport' % renew) - self.retry(wait_time=renew, reason="Passport renewal") + self.retry(wait_time=600, reason="Passport renewal") self.handleDownload(False) -- cgit v1.2.3 From dabee359dd8c3870e0302e99457e6dd1bb93d736 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 21 Oct 2014 16:01:05 +0200 Subject: Remove needless self.html --- module/plugins/hoster/MegasharesCom.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 61a314de4..e674ae7fa 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -47,8 +47,6 @@ class MegasharesCom(SimpleHoster): if self.NO_SLOTS_PATTERN in self.html: self.retry(wait_time=5 * 60) - self.getFileInfo() - m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) if m: passport_num = m.group(1) -- cgit v1.2.3 From e3f5280529921100f48bb8a79853bf480c7611e4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 02:53:05 +0200 Subject: Replace single quotes with doubles in self.error and self.fail msg --- module/plugins/hoster/MegasharesCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index e674ae7fa..c41e8b9e2 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -83,7 +83,7 @@ class MegasharesCom(SimpleHoster): # Check traffic left on passport m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) if m is None: - self.fail('Passport not found') + self.fail("Passport not found") self.logInfo("Download passport: %s" % m.group(1)) data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] -- 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/MegasharesCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index c41e8b9e2..29ae47509 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -52,7 +52,7 @@ class MegasharesCom(SimpleHoster): passport_num = m.group(1) request_uri = re.search(self.REQUEST_URI_PATTERN, self.html).group(1) - for _ in xrange(5): + for _i in xrange(5): random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1) verifyinput = self.decryptCaptcha( -- 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/MegasharesCom.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 29ae47509..9f21ce868 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -57,7 +57,7 @@ class MegasharesCom(SimpleHoster): verifyinput = self.decryptCaptcha( "http://d01.megashares.com/index.php?secgfx=gfx&random_num=%s" % random_num) - self.logInfo("Reactivating passport %s: %s %s" % (passport_num, random_num, verifyinput)) + self.logInfo(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput)) url = ("http://d01.megashares.com%s&rs=check_passport_renewal" % request_uri + "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) + @@ -71,23 +71,23 @@ class MegasharesCom(SimpleHoster): else: self.invalidCaptcha() else: - self.fail("Failed to reactivate passport") + self.fail(_("Failed to reactivate passport")) m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) if m: time = [int(x) for x in m.groups()] renew = time[0] + (time[1] * 60) + (time[2] * 60) - self.logDebug('Waiting %d seconds for a new passport' % renew) + self.logDebug("Waiting %d seconds for a new passport" % renew) self.retry(wait_time=renew, reason="Passport renewal") # Check traffic left on passport m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) if m is None: - self.fail("Passport not found") + self.fail(_("Passport not found")) - self.logInfo("Download passport: %s" % m.group(1)) + self.logInfo(_("Download passport: %s") % m.group(1)) data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] - self.logInfo("Data left: %s %s (%d MB needed)" % (m.group(2), m.group(3), self.pyfile.size / 1048576)) + self.logInfo(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: self.retry(wait_time=600, reason="Passport renewal") @@ -98,7 +98,7 @@ class MegasharesCom(SimpleHoster): def handleDownload(self, premium=False): # Find download link; m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) - msg = '%s download URL' % ('Premium' if premium else 'Free') + msg = _('%s download URL' % ('Premium' if premium else 'Free')) if m is None: self.error(msg) -- cgit v1.2.3 From 146fe1e309c33ab149bfaf58ad86c0dd4fb9b156 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 27 Oct 2014 01:18:45 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/MegasharesCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 9f21ce868..3d575b588 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -78,7 +78,7 @@ class MegasharesCom(SimpleHoster): time = [int(x) for x in m.groups()] renew = time[0] + (time[1] * 60) + (time[2] * 60) self.logDebug("Waiting %d seconds for a new passport" % renew) - self.retry(wait_time=renew, reason="Passport renewal") + self.retry(wait_time=renew, reason=_("Passport renewal")) # Check traffic left on passport m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) @@ -90,7 +90,7 @@ class MegasharesCom(SimpleHoster): self.logInfo(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: - self.retry(wait_time=600, reason="Passport renewal") + self.retry(wait_time=600, reason=_("Passport renewal")) self.handleDownload(False) -- 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/MegasharesCom.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 3d575b588..50c6bf539 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -8,16 +8,16 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): - __name__ = "MegasharesCom" - __type__ = "hoster" + __name__ = "MegasharesCom" + __type__ = "hoster" __version__ = "0.27" __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' __description__ = """Megashares.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] FILE_NAME_PATTERN = r'

]*title="(?P[^"]+)">' -- cgit v1.2.3 From 772e47ef806d18fd209e910be0535bce7c07dc7b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 2 Nov 2014 22:47:07 +0100 Subject: Update all other plugins --- module/plugins/hoster/MegasharesCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 50c6bf539..486ff2b37 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -20,8 +20,8 @@ class MegasharesCom(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - FILE_NAME_PATTERN = r'

]*title="(?P[^"]+)">' - FILE_SIZE_PATTERN = r'Filesize: (?P[\d.,]+) (?P[\w^_]+)' + NAME_PATTERN = r'

]*title="(?P[^"]+)">' + SIZE_PATTERN = r'Filesize: (?P[\d.,]+) (?P[\w^_]+)' OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted|Invalid link)' LINK_PATTERN = r'
]*>\s*' -- cgit v1.2.3 From c9e31d875d32de31e54959b82bc35eff2b3e0f3f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 10 Nov 2014 00:19:51 +0100 Subject: Code cosmetics --- module/plugins/hoster/MegasharesCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 486ff2b37..6b1472dd8 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -63,9 +63,9 @@ class MegasharesCom(SimpleHoster): "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) + "&rsargs[]=replace_sec_pprenewal&rsrnd=%s" % str(int(time() * 1000))) self.logDebug(url) - response = self.load(url) + res = self.load(url) - if 'Thank you for reactivating your passport.' in response: + if 'Thank you for reactivating your passport.' in res: self.correctCaptcha() self.retry() else: -- cgit v1.2.3 From 67587fbe0335cacfde28a86ba729b9d567ce1da7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 7 Dec 2014 00:27:18 +0100 Subject: Plugin code cosmetics (3) --- module/plugins/hoster/MegasharesCom.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/MegasharesCom.py') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 6b1472dd8..9d8441c6f 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -36,7 +36,7 @@ class MegasharesCom(SimpleHoster): def setup(self): self.resumeDownload = True - self.multiDL = self.premium + self.multiDL = self.premium def handlePremium(self): @@ -55,15 +55,18 @@ class MegasharesCom(SimpleHoster): for _i in xrange(5): random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1) - verifyinput = self.decryptCaptcha( - "http://d01.megashares.com/index.php?secgfx=gfx&random_num=%s" % random_num) + verifyinput = self.decryptCaptcha("http://d01.megashares.com/index.php", + get={'secgfx': "gfx", 'random_num': random_num}) + self.logInfo(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput)) - url = ("http://d01.megashares.com%s&rs=check_passport_renewal" % request_uri + - "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) + - "&rsargs[]=replace_sec_pprenewal&rsrnd=%s" % str(int(time() * 1000))) - self.logDebug(url) - res = self.load(url) + res = self.load("http://d01.megashares.com%s" % request_uri, + get={'rs' : "check_passport_renewal", + 'rsargs[]': verifyinput, + 'rsargs[]': random_num, + 'rsargs[]': passport_num, + 'rsargs[]': "replace_sec_pprenewal", + 'rsrnd[]' : str(int(time() * 1000))}) if 'Thank you for reactivating your passport.' in res: self.correctCaptcha() -- cgit v1.2.3