summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar AndroKev <neureither.kevin@gmail.com> 2013-11-02 20:05:52 +0100
committerGravatar AndroKev <neureither.kevin@gmail.com> 2013-11-02 20:05:52 +0100
commita3686cc3851b64eab7597422e66bc8e5b9d54120 (patch)
tree52595439b2a52738ab68746834e3e3cea4695531
parentDeleted the wildcard (diff)
parentNew crypter: FreetexthostCom (diff)
downloadpyload-a3686cc3851b64eab7597422e66bc8e5b9d54120.tar.xz
Merge remote-tracking branch 'upstream/stable' into stable
test
-rw-r--r--module/plugins/accounts/RealdebridCom.py4
-rw-r--r--module/plugins/crypter/FreetexthostCom.py37
-rw-r--r--module/plugins/crypter/PastebinCom.py31
-rwxr-xr-xmodule/plugins/hooks/Captcha9kw.py7
-rw-r--r--module/plugins/hoster/Keep2shareCC.py9
-rw-r--r--module/plugins/hoster/RealdebridCom.py4
-rw-r--r--module/plugins/hoster/YoutubeCom.py4
-rw-r--r--module/plugins/internal/SimpleHoster.py74
8 files changed, 133 insertions, 37 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}
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 <http://www.gnu.org/licenses/>. #
+############################################################################
+
+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'<div id="contentsinner">\s*(.+)<div class="viewcount">', 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("<br />\r\n")
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 <http://www.gnu.org/licenses/>. #
+############################################################################
+
+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'<div class="de\d+">(https?://[^ <]+)(?:[^<]*)</div>'
+ TITLE_PATTERN = r'<div class="paste_box_line1" title="(?P<title>[^"]+)">'
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")
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 <http://www.gnu.org/licenses/>. #
############################################################################
+# 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<ID>.+)"
+ __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<ID>")]
+
def handleFree(self):
fid = re.search(r'<input type="hidden" name="slow_id" value="([^"]+)">', self.html).group(1)
self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': fid})
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)
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)
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<tag><form[^>]*%s[^>]*>)(?P<content>.*?)</?(form|body|html)[^>]*>" % attr_str, html, re.S | re.I):
+ for form in re.finditer(r"(?P<tag><form[^>]*%s[^>]*>)(?P<content>.*?)</?(form|body|html)[^>]*>" % attr_str,
+ html, re.S | re.I):
inputs = {}
action = parseHtmlTagAttrValue("action", form.group('tag'))
for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('content'), re.S | re.I):
@@ -65,19 +70,20 @@ def parseHtmlForm(attr_str, html, input_names=None):
continue
elif hasattr(val, "search") and re.match(val, inputs[key]):
continue
- break # attibute value does not match
+ break # attibute value does not match
else:
- break # attibute name does not match
+ break # attibute name does not match
else:
- return action, inputs # passed attribute check
+ return action, inputs # passed attribute check
else:
# no attribute check
return action, inputs
- return {}, None # no matching form found
+ return {}, None # no matching form found
+
-def parseFileInfo(self, url = '', html = ''):
- info = {"name" : url, "size" : 0, "status" : 3}
+def parseFileInfo(self, url='', html=''):
+ info = {"name": url, "size": 0, "status": 3}
if hasattr(self, "pyfile"):
url = self.pyfile.url
@@ -85,10 +91,12 @@ def parseFileInfo(self, url = '', html = ''):
if hasattr(self, "req") and self.req.http.code == '404':
info['status'] = 1
else:
- if not html and hasattr(self, "html"): html = self.html
+ if not html and hasattr(self, "html"):
+ html = self.html
if isinstance(self.SH_BROKEN_ENCODING, (str, unicode)):
html = unicode(html, self.SH_BROKEN_ENCODING)
- if hasattr(self, "html"): self.html = html
+ if hasattr(self, "html"):
+ self.html = html
if hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, html):
# File offline
@@ -113,10 +121,12 @@ def parseFileInfo(self, url = '', html = ''):
if 'N' in info:
info['name'] = replace_patterns(info['N'], self.FILE_NAME_REPLACEMENTS)
if 'S' in info:
- size = replace_patterns(info['S'] + info['U'] if 'U' in info else info['S'], self.FILE_SIZE_REPLACEMENTS)
+ size = replace_patterns(info['S'] + info['U'] if 'U' in info else info['S'],
+ self.FILE_SIZE_REPLACEMENTS)
info['size'] = parseFileSize(size)
elif isinstance(info['size'], (str, unicode)):
- if 'units' in info: info['size'] += info['units']
+ if 'units' in info:
+ info['size'] += info['units']
info['size'] = parseFileSize(info['size'])
if hasattr(self, "file_info"):
@@ -124,34 +134,41 @@ def parseFileInfo(self, url = '', html = ''):
return info['name'], info['size'], info['status'], url
+
def create_getInfo(plugin):
def getInfo(urls):
for url in urls:
cj = CookieJar(plugin.__name__)
- if isinstance(plugin.SH_COOKIES, list): set_cookies(cj, plugin.SH_COOKIES)
+ if isinstance(plugin.SH_COOKIES, list):
+ set_cookies(cj, plugin.SH_COOKIES)
file_info = parseFileInfo(plugin, url, getURL(replace_patterns(url, plugin.FILE_URL_REPLACEMENTS),
- decode = not plugin.SH_BROKEN_ENCODING, cookies = cj))
+ decode=not plugin.SH_BROKEN_ENCODING, cookies=cj))
yield file_info
+
return getInfo
+
def timestamp():
- return int(time()*1000)
+ return int(time() * 1000)
+
class PluginParseError(Exception):
def __init__(self, msg):
Exception.__init__(self)
self.value = 'Parse error (%s) - plugin may be out of date' % msg
+
def __str__(self):
return repr(self.value)
+
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
- __version__ = "0.30"
+ __version__ = "0.31"
__pattern__ = None
__type__ = "hoster"
__description__ = """Base hoster plugin"""
- __author_name__ = ("zoidberg")
- __author_mail__ = ("zoidberg@mujmail.cz")
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
"""
These patterns should be defined by each hoster:
FILE_INFO_PATTERN = r'(?P<N>file_name) (?P<S>file_size) (?P<U>units)'
@@ -159,15 +176,17 @@ class SimpleHoster(Hoster):
and FILE_SIZE_PATTERN = r'(?P<S>file_size) (?P<U>units)'
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