From e64a821f51c57fc6fb516a115f69d7d3c939e15e Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 29 Oct 2013 14:45:07 +0100 Subject: SimpleHoster: new PREMIUM_ONLY_PATTERN (see #350). + cosmetics --- module/plugins/internal/SimpleHoster.py | 74 +++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 53f2e9f19..856d3fde6 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -25,6 +25,7 @@ from module.utils import html_unescape, fixup, parseFileSize from module.network.RequestFactory import getURL from module.network.CookieJar import CookieJar + def replace_patterns(string, ruleslist): for r in ruleslist: rf, rt = r @@ -32,18 +33,22 @@ def replace_patterns(string, ruleslist): #self.logDebug(rf, rt, string) return string + def set_cookies(cj, cookies): for cookie in cookies: if isinstance(cookie, tuple) and len(cookie) == 3: domain, name, value = cookie cj.setCookie(domain, name, value) + def parseHtmlTagAttrValue(attr_name, tag): - m = re.search(r"%s\s*=\s*([\"']?)((?<=\")[^\"]+|(?<=')[^']+|[^>\s\"'][^>\s]*)\1" % attr_name, tag, re.I) - return m.group(2) if m else None + m = re.search(r"%s\s*=\s*([\"']?)((?<=\")[^\"]+|(?<=')[^']+|[^>\s\"'][^>\s]*)\1" % attr_name, tag, re.I) + return m.group(2) if m else None + def parseHtmlForm(attr_str, html, input_names=None): - for form in re.finditer(r"(?P]*%s[^>]*>)(?P.*?)]*>" % attr_str, html, re.S | re.I): + for form in re.finditer(r"(?P]*%s[^>]*>)(?P.*?)]*>" % attr_str, + html, re.S | re.I): inputs = {} action = parseHtmlTagAttrValue("action", form.group('tag')) for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=file_name) (?Pfile_size) (?Punits)' @@ -159,15 +176,17 @@ class SimpleHoster(Hoster): and FILE_SIZE_PATTERN = r'(?Pfile_size) (?Punits)' FILE_OFFLINE_PATTERN = r'File (deleted|not found)' TEMP_OFFLINE_PATTERN = r'Server maintainance' + + You can also define a PREMIUM_ONLY_PATTERN to detect links that can be downloaded only with a premium account. """ FILE_SIZE_REPLACEMENTS = [] FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup)] FILE_URL_REPLACEMENTS = [] - SH_BROKEN_ENCODING = False # Set to True or encoding name if encoding in http header is not correct - SH_COOKIES = True # or False or list of tuples [(domain, name, value)] - SH_CHECK_TRAFFIC = False # True = force check traffic left for a premium account + SH_BROKEN_ENCODING = False # Set to True or encoding name if encoding in http header is not correct + SH_COOKIES = True # or False or list of tuples [(domain, name, value)] + SH_CHECK_TRAFFIC = False # True = force check traffic left for a premium account def init(self): self.file_info = {} @@ -189,11 +208,14 @@ class SimpleHoster(Hoster): else: # This line is required due to the getURL workaround. Can be removed in 0.5 self.html = self.load(pyfile.url, decode=not self.SH_BROKEN_ENCODING, cookies=self.SH_COOKIES) + if hasattr(self, 'PREMIUM_ONLY_PATTERN') and re.search(self.PREMIUM_ONLY_PATTERN, self.html): + self.fail("This link require a premium account") self.handleFree() def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False): if type(url) == unicode: url = url.encode('utf8') - return Hoster.load(self, url=url, get=get, post=post, ref=ref, cookies=cookies, just_header=just_header, decode=decode) + return Hoster.load(self, url=url, get=get, post=post, ref=ref, cookies=cookies, + just_header=just_header, decode=decode) def getFileInfo(self): self.logDebug("URL: %s" % self.pyfile.url) @@ -230,7 +252,7 @@ class SimpleHoster(Hoster): def parseError(self, msg): raise PluginParseError(msg) - def longWait(self, wait_time = None, max_tries = 3): + def longWait(self, wait_time=None, max_tries=3): if wait_time and isinstance(wait_time, (int, long, float)): time_str = "%dh %dm" % divmod(wait_time / 60, 60) else: @@ -242,7 +264,7 @@ class SimpleHoster(Hoster): self.setWait(wait_time, True) self.wait() - self.retry(max_tries = max_tries, reason="Download limit reached") + self.retry(max_tries=max_tries, reason="Download limit reached") def parseHtmlForm(self, attr_str='', input_names=None): return parseHtmlForm(attr_str, self.html, input_names) @@ -253,4 +275,4 @@ class SimpleHoster(Hoster): return True size = self.pyfile.size / 1024 self.logInfo("Filesize: %i KiB, Traffic left for user %s: %i KiB" % (size, self.user, traffic)) - return size <= traffic \ No newline at end of file + return size <= traffic -- cgit v1.2.3 From 29f6a9e8638184d3c4618898a8708023e51b55e5 Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 29 Oct 2013 14:58:06 +0100 Subject: YouTube: using ASCII instead of LATIN-1. Fixes #353 --- module/plugins/hoster/YoutubeCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 9ef49c2d6..319eb36e6 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -36,7 +36,7 @@ class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" __pattern__ = r"https?://(?:[^/]*?)youtube\.com/watch.*?[?&]v=.*" - __version__ = "0.37" + __version__ = "0.38" __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting", "hd"), ("fmt", "int", "FMT/ITAG Number (5-102, 0 for auto)", 0), (".mp4", "bool", "Allow .mp4", True), @@ -138,7 +138,7 @@ class YoutubeCom(Hoster): name = re.search(file_name_pattern, html).group(1).replace("/", "") # Cleaning invalid characters from the file name - name = name.encode('latin-1', 'replace') + name = name.encode('ascii', 'replace') pyfile.name = html_unescape(name) -- cgit v1.2.3 From f379668d9e037ead32bcb579b6f6a8378ca37d4f Mon Sep 17 00:00:00 2001 From: stefanos Date: Thu, 31 Oct 2013 14:11:09 +0100 Subject: Captcha9kw: merged #356 --- module/plugins/hooks/Captcha9kw.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index d6fef549f..6a9de24de 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -29,7 +29,7 @@ from module.plugins.Hook import Hook class Captcha9kw(Hook): __name__ = "Captcha9kw" - __version__ = "0.08" + __version__ = "0.09" __description__ = """send captchas to 9kw.eu""" __config__ = [("activated", "bool", "Activated", False), ("force", "bool", "Force CT even if client is connected", True), @@ -38,8 +38,9 @@ class Captcha9kw(Hook): ("captchaperhour", "int", "Captcha per hour (max. 9999)", "9999"), ("prio", "int", "Prio 1-10 (Cost +1-10)", "0"), ("selfsolve", "bool", - "If enabled and you have a 9kw client active only you will get your captcha to solve it", "False"), - ("timeout", "int", "Timeout (max. 300)", "220"), + "If enabled and you have a 9kw client active only you will get your captcha to solve it (Selfsolve)", + "False"), + ("timeout", "int", "Timeout (max. 300)", "300"), ("passkey", "password", "API key", ""), ] __author_name__ = ("RaNaN") __author_mail__ = ("RaNaN@pyload.org") -- cgit v1.2.3 From cc5be0a68ed2087da3cc2c3c39d7f8fa7f609811 Mon Sep 17 00:00:00 2001 From: Stefano Date: Thu, 31 Oct 2013 16:39:45 +0100 Subject: Keep2share: added k2s.cc support see #92 --- module/plugins/hoster/Keep2shareCC.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index 5e4f5f540..2eada84ec 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -15,6 +15,9 @@ # along with this program. If not, see . # ############################################################################ +# Test links (random.bin): +# http://k2s.cc/file/527111edfb9ba/random.bin + import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -24,8 +27,8 @@ from module.plugins.internal.CaptchaService import ReCaptcha class Keep2shareCC(SimpleHoster): __name__ = "Keep2shareCC" __type__ = "hoster" - __pattern__ = r"http://(?:www\.)?keep2share\.cc/file/\w+" - __version__ = "0.03" + __pattern__ = r"http://(?:www\.)?(?:keep2share|k2s)\.cc/file/(?P.+)" + __version__ = "0.04" __description__ = """Keep2share.cc hoster plugin""" __author_name__ = ("stickell") __author_mail__ = ("l.stickell@yahoo.it") @@ -39,6 +42,8 @@ class Keep2shareCC(SimpleHoster): RECAPTCHA_KEY = '6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb' + FILE_URL_REPLACEMENTS = [(__pattern__, r"http://www.keep2share.cc/file/\g")] + def handleFree(self): fid = re.search(r'', self.html).group(1) self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': fid}) -- cgit v1.2.3 From 2741891cd9d757548ac70e4122b80e14a83afeb2 Mon Sep 17 00:00:00 2001 From: chaosmaker Date: Fri, 1 Nov 2013 17:10:25 +0000 Subject: Update RealdebridCom.py Changed Line 51 to use https instead of http as RealDebrid now only supports that. --- module/plugins/hoster/RealdebridCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 59997ee7c..40ee96df9 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -13,7 +13,7 @@ from module.plugins.Hoster import Hoster class RealdebridCom(Hoster): __name__ = "RealdebridCom" - __version__ = "0.52" + __version__ = "0.53" __type__ = "hoster" __pattern__ = r"https?://.*real-debrid\..*" @@ -48,7 +48,7 @@ class RealdebridCom(Hoster): else: password = password[0] - url = "http://real-debrid.com/ajax/unrestrict.php?lang=en&link=%s&password=%s&time=%s" % ( + url = "https://real-debrid.com/ajax/unrestrict.php?lang=en&link=%s&password=%s&time=%s" % ( quote(pyfile.url, ""), password, int(time() * 1000)) page = self.load(url) data = json_loads(page) -- cgit v1.2.3 From 277b8647356b2603ebdb8958de4113c2f9462894 Mon Sep 17 00:00:00 2001 From: chaosmaker Date: Fri, 1 Nov 2013 17:11:54 +0000 Subject: Update RealdebridCom.py Real Debrid now only accepts https connections to any of their api and hence the change --- module/plugins/accounts/RealdebridCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 6cac5d0bb..a9980b088 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -5,7 +5,7 @@ from module.plugins.Account import Account class RealdebridCom(Account): __name__ = "RealdebridCom" - __version__ = "0.42" + __version__ = "0.43" __type__ = "account" __description__ = """Real-Debrid.com account plugin""" __author_name__ = ("Devirex, Hazzard") @@ -14,7 +14,7 @@ class RealdebridCom(Account): def loadAccountInfo(self, user, req): if self.pin_code: return {"premium": False} - page = req.load("http://real-debrid.com/api/account.php") + page = req.load("https://real-debrid.com/api/account.php") xml = dom.parseString(page) account_info = {"validuntil": int(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue), "trafficleft": -1} -- cgit v1.2.3 From 7a80906521ba6013e549f29bcdf105e2bed3f11b Mon Sep 17 00:00:00 2001 From: Stefano Date: Fri, 1 Nov 2013 23:53:56 +0100 Subject: New crypter: PastebinCom Requested in #361 --- module/plugins/crypter/PastebinCom.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 module/plugins/crypter/PastebinCom.py diff --git a/module/plugins/crypter/PastebinCom.py b/module/plugins/crypter/PastebinCom.py new file mode 100644 index 000000000..942ab613b --- /dev/null +++ b/module/plugins/crypter/PastebinCom.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +############################################################################ +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +############################################################################ + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class PastebinCom(SimpleCrypter): + __name__ = "PastebinCom" + __type__ = "crypter" + __pattern__ = r"http://(?:w{3}.)?pastebin\.com/\w+" + __version__ = "0.01" + __description__ = """Pastebin.com Plugin""" + __author_name__ = ("stickell") + __author_mail__ = ("l.stickell@yahoo.it") + + LINK_PATTERN = r'
(https?://[^ <]+)(?:[^<]*)
' + TITLE_PATTERN = r'
' -- cgit v1.2.3 From 11bb888aca3ef536811d35edc4dad57dc00643aa Mon Sep 17 00:00:00 2001 From: Stefano Date: Fri, 1 Nov 2013 23:54:35 +0100 Subject: New crypter: FreetexthostCom Requested in #360 --- module/plugins/crypter/FreetexthostCom.py | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 module/plugins/crypter/FreetexthostCom.py diff --git a/module/plugins/crypter/FreetexthostCom.py b/module/plugins/crypter/FreetexthostCom.py new file mode 100644 index 000000000..8d165abe4 --- /dev/null +++ b/module/plugins/crypter/FreetexthostCom.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +############################################################################ +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +############################################################################ + +import re + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class FreetexthostCom(SimpleCrypter): + __name__ = "FreetexthostCom" + __type__ = "crypter" + __pattern__ = r"http://(?:w{3}.)?freetexthost\.com/\w+" + __version__ = "0.01" + __description__ = """Freetexthost.com Plugin""" + __author_name__ = ("stickell") + __author_mail__ = ("l.stickell@yahoo.it") + + def getLinks(self): + m = re.search(r'
\s*(.+)
', self.html, re.DOTALL) + if not m: + self.fail('Unable to extract links | Plugin may be out-of-date') + links = m.group(1) + return links.strip().split("
\r\n") -- cgit v1.2.3