summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/accounts/EasybytezCom.py10
-rw-r--r--module/plugins/accounts/SafesharingEu.py19
-rw-r--r--module/plugins/crypter/LinkCryptWs.py7
-rwxr-xr-xmodule/plugins/hooks/Captcha9kw.py31
-rw-r--r--module/plugins/hooks/XFileSharingPro.py6
-rw-r--r--module/plugins/hoster/BasePlugin.py89
-rw-r--r--module/plugins/hoster/HugefilesNet.py9
-rw-r--r--module/plugins/hoster/SafesharingEu.py36
-rw-r--r--module/plugins/internal/CaptchaService.py16
-rw-r--r--module/plugins/internal/SimpleHoster.py68
-rw-r--r--module/plugins/internal/UnRar.py14
-rw-r--r--module/plugins/internal/XFSAccount.py14
-rw-r--r--module/plugins/internal/XFSHoster.py35
13 files changed, 221 insertions, 133 deletions
diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py
index 87f1df6dd..0afd93d3b 100644
--- a/module/plugins/accounts/EasybytezCom.py
+++ b/module/plugins/accounts/EasybytezCom.py
@@ -2,15 +2,13 @@
import re
-from time import mktime, strptime, gmtime
-
from module.plugins.internal.XFSAccount import XFSAccount
class EasybytezCom(XFSAccount):
__name__ = "EasybytezCom"
__type__ = "account"
- __version__ = "0.10"
+ __version__ = "0.11"
__description__ = """EasyBytez.com account plugin"""
__license__ = "GPLv3"
@@ -19,3 +17,9 @@ class EasybytezCom(XFSAccount):
HOSTER_DOMAIN = "easybytez.com"
+
+
+ def loadAccountInfo(self, *args, **kwargs):
+ info = super(EasybytezCom, self).loadAccountInfo(*args, **kwargs)
+ info['leechtraffic'] = 26214400
+ return info
diff --git a/module/plugins/accounts/SafesharingEu.py b/module/plugins/accounts/SafesharingEu.py
new file mode 100644
index 000000000..a2b964cba
--- /dev/null
+++ b/module/plugins/accounts/SafesharingEu.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.XFSAccount import XFSAccount
+
+
+class SafesharingEu(XFSAccount):
+ __name__ = "SafesharingEu"
+ __type__ = "account"
+ __version__ = "0.02"
+
+ __description__ = """Safesharing.eu account plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("guidobelix", "guidobelix@hotmail.it")]
+
+
+ HOSTER_DOMAIN = "safesharing.eu"
+
+ VALID_UNTIL_PATTERN = r'> Premium.[Aa]ccount expire:(.+?)</div>'
+ TRAFFIC_LEFT_PATTERN = r'> Traffic available today:\s*?(?P<S>[\d.,]+)\s*?(?:(?P<U>[\w^_]+)\s*)?</div>'
diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py
index 578595228..835a549b2 100644
--- a/module/plugins/crypter/LinkCryptWs.py
+++ b/module/plugins/crypter/LinkCryptWs.py
@@ -15,14 +15,15 @@ from module.utils import html_unescape
class LinkCryptWs(Crypter):
__name__ = "LinkCryptWs"
__type__ = "crypter"
- __version__ = "0.06"
+ __version__ = "0.07"
__pattern__ = r'http://(?:www\.)?linkcrypt\.ws/(dir|container)/(?P<ID>\w+)'
__description__ = """LinkCrypt.ws decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("kagenoshin", "kagenoshin[AT]gmx[DOT]ch"),
- ("glukgluk", None)]
+ ("glukgluk", None),
+ ("Gummibaer", None)]
CRYPTED_KEY = "crypted"
@@ -37,7 +38,7 @@ class LinkCryptWs(Crypter):
def prepare(self):
# Init
- self.fileid = re.match(self.__pattern__, pyfile.url).group('ID')
+ self.fileid = re.match(self.__pattern__, self.pyfile.url).group('ID')
self.req.cj.setCookie("linkcrypt.ws", "language", "en")
diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py
index 77375fb8b..38b39b2af 100755
--- a/module/plugins/hooks/Captcha9kw.py
+++ b/module/plugins/hooks/Captcha9kw.py
@@ -17,19 +17,20 @@ from module.plugins.Hook import Hook
class Captcha9kw(Hook):
__name__ = "Captcha9kw"
__type__ = "hook"
- __version__ = "0.24"
-
- __config__ = [("activated", "bool", "Activated", True),
- ("ssl", "bool", "Use HTTPS", True),
- ("force", "bool", "Force captcha resolving even if client is connected", True),
- ("confirm", "bool", "Confirm Captcha (cost +6 credits)", False),
- ("captchaperhour", "int", "Captcha per hour", "9999"),
- ("prio", "int", "Priority (max 10)(cost +0 -> +10 credits)", "0"),
- ("queue", "int", "Max. Queue (max 999)", "50"),
- ("hoster_options", "string", "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"),
- ("selfsolve", "bool", "Selfsolve (manually solve your captcha in your 9kw client if active)", "0"),
- ("passkey", "password", "API key", ""),
- ("timeout", "int", "Timeout in seconds (min 60, max 3999)", "900")]
+ __version__ = "0.25"
+
+ __config__ = [("activated" , "bool" , "Activated" , True ),
+ ("ssl" , "bool" , "Use HTTPS" , True ),
+ ("force" , "bool" , "Force captcha resolving even if client is connected" , True ),
+ ("confirm" , "bool" , "Confirm Captcha (cost +6 credits)" , False ),
+ ("captchaperhour", "int" , "Captcha per hour" , "9999" ),
+ ("captchapermin" , "int" , "Captcha per minute" , "9999" ),
+ ("prio" , "int" , "Priority (max 10)(cost +0 -> +10 credits)" , "0" ),
+ ("queue" , "int" , "Max. Queue (max 999)" , "50" ),
+ ("hoster_options", "string" , "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"),
+ ("selfsolve" , "bool" , "Selfsolve (manually solve your captcha in your 9kw client if active)" , "0" ),
+ ("passkey" , "password", "API key" , "" ),
+ ("timeout" , "int" , "Timeout in seconds (min 60, max 3999)" , "900" )]
__description__ = """Send captchas to 9kw.eu"""
__license__ = "GPLv3"
@@ -85,7 +86,8 @@ class Captcha9kw(Hook):
'confirm' : self.getConfig("confirm"),
'timeout' : min(max(self.getConfig("timeout"), 300), 3999),
'selfsolve' : self.getConfig("selfsolve"),
- 'cph' : self.getConfig("captchaperhour")}
+ 'cph' : self.getConfig("captchaperhour"),
+ 'cpm' : self.getConfig("captchapermin")}
for opt in str(self.getConfig("hoster_options").split('|')):
@@ -112,6 +114,7 @@ class Captcha9kw(Hook):
'maxtimeout' : option['timeout'],
'selfsolve' : option['selfsolve'],
'captchaperhour': option['cph'],
+ 'captchapermin' : option['cpm'],
'case-sensitive': option['case_sensitive'],
'min_len' : option['min'],
'max_len' : option['max'],
diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py
index fd1fa760e..ab5086664 100644
--- a/module/plugins/hooks/XFileSharingPro.py
+++ b/module/plugins/hooks/XFileSharingPro.py
@@ -8,11 +8,11 @@ from module.plugins.Hook import Hook
class XFileSharingPro(Hook):
__name__ = "XFileSharingPro"
__type__ = "hook"
- __version__ = "0.23"
+ __version__ = "0.24"
__config__ = [("activated", "bool", "Activated", True),
- ("use_hoster_list", "bool", "Load listed hosters only", False),
- ("use_crypter_list", "bool", "Load listed crypters only", False),
+ ("use_hoster_list", "bool", "Load listed hosters only", True),
+ ("use_crypter_list", "bool", "Load listed crypters only", True),
("use_builtin_list", "bool", "Load built-in plugin list", True),
("hoster_list", "str", "Hoster list (comma separated)", ""),
("crypter_list", "str", "Crypter list (comma separated)", "")]
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py
index bdd7f782d..01a234d3b 100644
--- a/module/plugins/hoster/BasePlugin.py
+++ b/module/plugins/hoster/BasePlugin.py
@@ -13,7 +13,7 @@ from module.plugins.Hoster import Hoster
class BasePlugin(Hoster):
__name__ = "BasePlugin"
__type__ = "hoster"
- __version__ = "0.23"
+ __version__ = "0.24"
__pattern__ = r'^unmatchable$'
@@ -25,7 +25,7 @@ class BasePlugin(Hoster):
@classmethod
def getInfo(cls, url="", html=""): #@TODO: Move to hoster class in 0.4.10
- return {'name': urlparse(url).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3, 'url': url or ""}
+ return {'name': urlparse(url).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url or ""}
def setup(self):
@@ -38,40 +38,40 @@ class BasePlugin(Hoster):
pyfile.name = self.getInfo(pyfile.url)['name']
- if pyfile.url.startswith("http"):
- for _i in xrange(2):
- try:
- self.downloadFile(pyfile)
+ if not pyfile.url.startswith("http"):
+ self.fail(_("No plugin matched"))
+
+ for _i in xrange(5):
+ try:
+ self.downloadFile(pyfile)
- except BadHeader, e:
- if e.code is 404:
- self.offline()
+ except BadHeader, e:
+ if e.code is 404:
+ self.offline()
- elif e.code in (401, 403):
- self.logDebug("Auth required")
+ elif e.code in (401, 403):
+ self.logDebug("Auth required")
- account = self.core.accountManager.getAccountPlugin('Http')
- servers = [x['login'] for x in account.getAllAccounts()]
- server = urlparse(pyfile.url).netloc
+ account = self.core.accountManager.getAccountPlugin('Http')
+ servers = [x['login'] for x in account.getAllAccounts()]
+ server = urlparse(pyfile.url).netloc
- if server in servers:
- self.logDebug("Logging on to %s" % server)
- self.req.addAuth(account.accounts[server]['password'])
- else:
- for pwd in pyfile.package().password.splitlines():
- if ":" in pwd:
- self.req.addAuth(pwd.strip())
- break
- else:
- self.fail(_("Authorization required (username:password)"))
+ if server in servers:
+ self.logDebug("Logging on to %s" % server)
+ self.req.addAuth(account.accounts[server]['password'])
else:
- self.fail(e)
+ for pwd in pyfile.package().password.splitlines():
+ if ":" in pwd:
+ self.req.addAuth(pwd.strip())
+ break
+ else:
+ self.fail(_("Authorization required (username:password)"))
else:
- break
+ self.fail(e)
else:
- self.fail(_("No file downloaded")) #@TODO: Move to hoster class (check if self.lastDownload) in 0.4.10
+ break
else:
- self.fail(_("No plugin matched"))
+ self.fail(_("No file downloaded")) #@TODO: Move to hoster class (check if self.lastDownload) in 0.4.10
# if self.checkDownload({'empty': re.compile(r"^$")}) is "empty":
# self.fail(_("Empty file"))
@@ -80,27 +80,30 @@ class BasePlugin(Hoster):
def downloadFile(self, pyfile):
url = pyfile.url
- for _i in xrange(5):
- header = self.load(url, just_header=True)
+ for i in xrange(1, 7): #@TODO: retrieve the pycurl.MAXREDIRS value set by req
+ header = self.load(url, ref=True, cookies=True, just_header=True, decode=True)
- # self.load does not raise a BadHeader on 404 responses, do it here
- if 'code' in header and header['code'] == 404:
- raise BadHeader(404)
+ if 'location' not in header or not header['location']:
+ if 'code' in header and header['code'] not in (200, 201, 203, 206):
+ self.fail(_("File not found"), _("HTTP status code: %d") % header['code'])
+ else:
+ break
- if 'location' in header:
- self.logDebug("Location: " + header['location'])
+ location = header['location']
- base = re.match(r'https?://[^/]+', url).group(0)
+ self.logDebug("Redirect #%d to: %s" % (i, location))
- if header['location'].startswith("http"):
- url = header['location']
+ base = re.match(r'https?://[^/]+', url).group(0)
- elif header['location'].startswith("/"):
- url = base + unquote(header['location'])
+ if location.startswith("http"):
+ url = location
+
+ elif location.startswith("/"):
+ url = base + unquote(location)
- else:
- url = '%s/%s' % (base, unquote(header['location']))
else:
- break
+ url = "%s/%s" % (base, unquote(location))
+ else:
+ self.fail(_("Too many redirects"))
self.download(url, disposition=True)
diff --git a/module/plugins/hoster/HugefilesNet.py b/module/plugins/hoster/HugefilesNet.py
index cbbce119f..f7221f8c5 100644
--- a/module/plugins/hoster/HugefilesNet.py
+++ b/module/plugins/hoster/HugefilesNet.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
-#
-# Test links:
-# http://hugefiles.net/prthf9ya4w6s
+
+import re
from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
@@ -9,7 +8,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
class HugefilesNet(XFSHoster):
__name__ = "HugefilesNet"
__type__ = "hoster"
- __version__ = "0.04"
+ __version__ = "0.05"
__pattern__ = r'http://(?:www\.)?hugefiles\.net/\w{12}'
@@ -22,5 +21,7 @@ class HugefilesNet(XFSHoster):
SIZE_PATTERN = r'File Size:</span>\s*<span[^>]*>(?P<S>[^<]+)</span></div>'
+ FORM_INPUTS_MAP = {'ctype': re.compile(r'\d+')}
+
getInfo = create_getInfo(HugefilesNet)
diff --git a/module/plugins/hoster/SafesharingEu.py b/module/plugins/hoster/SafesharingEu.py
new file mode 100644
index 000000000..92a0ff932
--- /dev/null
+++ b/module/plugins/hoster/SafesharingEu.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
+
+
+class SafesharingEu(XFSHoster):
+ __name__ = "SafesharingEu"
+ __type__ = "hoster"
+ __version__ = "0.04"
+
+ __pattern__ = r'https?://(?:\w+\.)?safesharing.eu/\w+'
+
+ __description__ = """Safesharing.eu hoster plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")]
+
+ HOSTER_DOMAIN = "safesharing.eu"
+
+ FILE_NAME_PATTERN = r'Filename:</b></td><td nowrap>(?P<N>.*)</td></tr>'
+ FILE_SIZE_PATTERN = r'Size:</b></td><td>(?P<S>.*) (?P<U>[kKmMbB]*) <small>'
+
+ FILE_ID_PATTERN = r'<input type="hidden" name="id" value="(.*)">'
+ OFFLINE_PATTERN = r'<b>File Not Found</b>'
+ TEMP_OFFLINE_PATTERN = r'This server is in maintenance mode'
+
+
+ WAIT_PATTERN = r'You have to wait (\d+) minutes'
+ COUNTDOWN_PATTERN = r'<br><span id="countdown_str">Wait <span id=".*">(\d+)</span> seconds</span>'
+
+ RECAPTCHA_KEY_PATTERN = r'<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge\?k=(.*)"></script>'
+ RANDOM_STRING_PATTERN = r'<input type="hidden" name="rand" value="(.*)">'
+
+ ERROR_PATTERN = r'(?:<div class="alert alert-danger">)(.+?)(?:</div>)'
+
+
+getInfo = create_getInfo(SafesharingEu)
diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py
index 38775f519..7009e6986 100644
--- a/module/plugins/internal/CaptchaService.py
+++ b/module/plugins/internal/CaptchaService.py
@@ -7,7 +7,7 @@ from random import random
class CaptchaService:
__name__ = "CaptchaService"
- __version__ = "0.14"
+ __version__ = "0.15"
__description__ = """Base captcha service plugin"""
__license__ = "GPLv3"
@@ -52,7 +52,7 @@ class CaptchaService:
class ReCaptcha(CaptchaService):
__name__ = "ReCaptcha"
- __version__ = "0.07"
+ __version__ = "0.08"
__description__ = """ReCaptcha captcha service plugin"""
__license__ = "GPLv3"
@@ -92,7 +92,6 @@ class ReCaptcha(CaptchaService):
raise TypeError(errmsg)
js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={'k': key})
-
try:
challenge = re.search("challenge : '(.+?)',", js).group(1)
server = re.search("server : '(.+?)',", js).group(1)
@@ -101,6 +100,8 @@ class ReCaptcha(CaptchaService):
result = self.result(server, challenge)
+ self.plugin.logDebug("ReCaptcha result: %s" % result, "challenge: %s" % challenge)
+
return challenge, result
@@ -111,7 +112,7 @@ class ReCaptcha(CaptchaService):
class AdsCaptcha(CaptchaService):
__name__ = "AdsCaptcha"
- __version__ = "0.04"
+ __version__ = "0.05"
__description__ = """AdsCaptcha captcha service plugin"""
__license__ = "GPLv3"
@@ -154,7 +155,6 @@ class AdsCaptcha(CaptchaService):
CaptchaId, PublicKey = key
js = self.plugin.req.load("http://api.adscaptcha.com/Get.aspx", get={'CaptchaId': CaptchaId, 'PublicKey': PublicKey})
-
try:
challenge = re.search("challenge: '(.+?)',", js).group(1)
server = re.search("server: '(.+?)',", js).group(1)
@@ -163,6 +163,8 @@ class AdsCaptcha(CaptchaService):
result = self.result(server, challenge)
+ self.plugin.logDebug("AdsCaptcha result: %s" % result, "challenge: %s" % challenge)
+
return challenge, result
@@ -173,7 +175,7 @@ class AdsCaptcha(CaptchaService):
class SolveMedia(CaptchaService):
__name__ = "SolveMedia"
- __version__ = "0.05"
+ __version__ = "0.06"
__description__ = """SolveMedia captcha service plugin"""
__license__ = "GPLv3"
@@ -202,6 +204,8 @@ class SolveMedia(CaptchaService):
result = self.result(server, challenge)
+ self.plugin.logDebug("SolveMedia result: %s" % result, "challenge: %s" % challenge)
+
return challenge, result
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 01702d423..24a2fa6b0 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -5,8 +5,6 @@ import re
from time import time
from urlparse import urlparse
-from pycurl import FOLLOWLOCATION
-
from module.PyFile import statusMap as _statusMap
from module.network.CookieJar import CookieJar
from module.network.RequestFactory import getURL
@@ -34,7 +32,11 @@ def _error(self, reason, type):
#@TODO: Remove in 0.4.10
def _wait(self, seconds, reconnect):
if seconds:
- self.setWait(seconds, reconnect)
+ self.setWait(seconds)
+
+ if reconnect is not None:
+ self.wantReconnect = reconnect
+
super(SimpleHoster, self).wait()
@@ -57,12 +59,13 @@ def parseHtmlTagAttrValue(attr_name, tag):
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,
+def parseHtmlForm(attr_str, html, input_names={}):
+ 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):
+ action = parseHtmlTagAttrValue("action", form.group('TAG'))
+
+ for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('CONTENT'), re.S | re.I):
name = parseHtmlTagAttrValue("name", inputtag.group(1))
if name:
value = parseHtmlTagAttrValue("value", inputtag.group(1))
@@ -71,7 +74,7 @@ def parseHtmlForm(attr_str, html, input_names=None):
else:
inputs[name] = value
- if isinstance(input_names, dict):
+ if input_names:
# check input attributes
for key, val in input_names.iteritems():
if key in inputs:
@@ -111,23 +114,24 @@ def timestamp():
#@TODO: Move to hoster class in 0.4.10
def _getDirectLink(self, url):
- self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ header = self.load(url, ref=True, just_header=True, decode=True)
- html = self.load(url, ref=True, decode=True)
+ if not 'code' in header or header['code'] != 302:
+ return ""
- self.req.http.c.setopt(FOLLOWLOCATION, 1)
+ if not 'location' in header or not header['location']:
+ return ""
- if self.getInfo(url, html)['status'] is not 2:
- try:
- return re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I).group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10
- except:
- pass
+ # if 'content-type' in header and "text/plain" not in header['content-type']:
+ # return ""
+
+ return header['location']
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "0.61"
+ __version__ = "0.67"
__pattern__ = r'^unmatchable$'
@@ -198,7 +202,7 @@ class SimpleHoster(Hoster):
@classmethod
def getInfo(cls, url="", html=""):
- info = {'name': urlparse(url).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3, 'url': url or ""}
+ info = {'name': urlparse(url).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url or ""}
if not html:
if url:
@@ -225,13 +229,19 @@ class SimpleHoster(Hoster):
except:
pass
- for pattern in ("INFO_PATTERN", "NAME_PATTERN", "SIZE_PATTERN",
- "FILE_INFO_PATTERN", "FILE_NAME_PATTERN", "FILE_SIZE_PATTERN"): #@TODO: Remove in 0.4.10
+ for pattern in ("FILE_INFO_PATTERN", "INFO_PATTERN",
+ "FILE_NAME_PATTERN", "NAME_PATTERN",
+ "FILE_SIZE_PATTERN", "SIZE_PATTERN"): #@TODO: Remove old patterns starting with "FILE_" in 0.4.10
try:
attr = getattr(cls, pattern)
- info.update(re.search(attr, html).groupdict())
+ dict = re.search(attr, html).groupdict()
+
+ if all(True for k in dict if k not in info):
+ info.update(dict)
+
except AttributeError:
continue
+
else:
online = True
@@ -316,8 +326,7 @@ class SimpleHoster(Hoster):
premium_only = 'error' in self.info and self.info['error'] == "premium-only"
- info = self.getInfo(pyfile.url, self.html)
- self._updateInfo(info)
+ self._updateInfo(self.getInfo(pyfile.url, self.html))
self.checkNameSize()
@@ -409,7 +418,9 @@ class SimpleHoster(Hoster):
#: Deprecated
def getFileInfo(self):
- return self.checkInfo()
+ self.info = {}
+ self.checkInfo()
+ return self.info
def _updateInfo(self, info):
@@ -419,14 +430,15 @@ class SimpleHoster(Hoster):
def handleDirect(self):
- self.link = _getDirectLink(self, self.pyfile.url)
+ link = _getDirectLink(self, self.pyfile.url)
- if self.link:
+ if link:
self.logInfo(_("Direct download link detected"))
+ self.link = link
+
self._updateInfo(self.getInfo(self.pyfile.url))
self.checkNameSize()
-
else:
self.logDebug(_("Direct download link not found"))
@@ -480,7 +492,7 @@ class SimpleHoster(Hoster):
self.retry(max_tries=max_tries, reason=_("Download limit reached"))
- def parseHtmlForm(self, attr_str='', input_names=None):
+ def parseHtmlForm(self, attr_str="", input_names={}):
return parseHtmlForm(attr_str, self.html, input_names)
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index 12bd84d20..c15a4c96e 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -22,7 +22,7 @@ def renice(pid, value):
class UnRar(AbtractExtractor):
__name__ = "UnRar"
- __version__ = "0.18"
+ __version__ = "0.19"
__description__ = """Rar extractor plugin"""
__license__ = "GPLv3"
@@ -32,12 +32,12 @@ class UnRar(AbtractExtractor):
CMD = "unrar"
# there are some more uncovered rar formats
- re_version = re.compile(r"(UNRAR 5[\d.]+(.*?)freeware)")
- re_splitfile = re.compile(r"(.*)\.part(\d+)\.rar$", re.I)
- re_partfiles = re.compile(r".*\.(rar|r\d+)", re.I)
- re_filelist = re.compile(r"(.+)\s+(\d+)\s+(\d+)\s+")
- re_filelist5 = re.compile(r"(.+)\s+(\d+)\s+\d\d-\d\d-\d\d\s+\d\d:\d\d\s+(.+)")
- re_wrongpwd = re.compile("(Corrupt file or wrong password|password incorrect)", re.I)
+ re_version = re.compile(r'UNRAR ([\w .]+?) freeware')
+ re_splitfile = re.compile(r'(.*)\.part(\d+)\.rar$', re.I)
+ re_partfiles = re.compile(r'.*\.(rar|r\d+)', re.I)
+ re_filelist = re.compile(r'(.+)\s+(\d+)\s+(\d+)\s+')
+ re_filelist5 = re.compile(r'(.+)\s+(\d+)\s+\d\d-\d\d-\d\d\s+\d\d:\d\d\s+(.+)')
+ re_wrongpwd = re.compile(r'(Corrupt file or wrong password|password incorrect)', re.I)
@staticmethod
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index f2a4e8a15..5a265c08a 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies
class XFSAccount(Account):
__name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.30"
+ __version__ = "0.31"
__description__ = """XFileSharing account plugin"""
__license__ = "GPLv3"
@@ -109,12 +109,12 @@ class XFSAccount(Account):
else:
self.logDebug("TRAFFIC_LEFT_PATTERN not found")
- m = re.finditer(self.LEECH_TRAFFIC_PATTERN, html)
- if m:
+ leech = [m.groupdict() for m in re.finditer(self.LEECH_TRAFFIC_PATTERN, html)]
+ if leech:
leechtraffic = 0
try:
- for leech in m:
- size = leech['S']
+ for traffic in leech:
+ size = traffic['S']
if "nlimited" in size:
leechtraffic = -1
@@ -122,8 +122,8 @@ class XFSAccount(Account):
validuntil = -1
break
else:
- if 'U' in leech:
- unit = leech['U']
+ if 'U' in traffic:
+ unit = traffic['U']
elif isinstance(self.LEECH_TRAFFIC_UNIT, basestring):
unit = self.LEECH_TRAFFIC_UNIT
else:
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 30864ef02..2aaf18b1a 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -16,7 +16,7 @@ from module.utils import html_unescape
class XFSHoster(SimpleHoster):
__name__ = "XFSHoster"
__type__ = "hoster"
- __version__ = "0.24"
+ __version__ = "0.26"
__pattern__ = r'^unmatchable$'
@@ -33,10 +33,10 @@ class XFSHoster(SimpleHoster):
TEXT_ENCODING = False
COOKIES = [(HOSTER_DOMAIN, "lang", "english")]
CHECK_DIRECT_LINK = None
- MULTI_HOSTER = False
+ MULTI_HOSTER = True #@NOTE: Should be default to False for safe, but I'm lazy...
INFO_PATTERN = r'<tr><td align=right><b>Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>\s*.*?<small>\((?P<S>[^<]+)\)</small>'
- NAME_PATTERN = r'(>Filename:</b></td><td nowrap>|name="fname" value="|<span class="name">|<[Tt]itle>.*?Download )(?P<N>.+?)(\s*<|")'
+ NAME_PATTERN = r'(>Filename:</b></td><td nowrap>|name="fname" value="|<span class="name">)(?P<N>.+?)(\s*<|")'
SIZE_PATTERN = r'(>Size:</b></td><td>|>File:.*>|<span class="size">)(?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)'
OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)'
@@ -46,14 +46,17 @@ class XFSHoster(SimpleHoster):
PREMIUM_ONLY_PATTERN = r'>This file is available for Premium Users only'
ERROR_PATTERN = r'(?:class=["\']err["\'].*?>|<[Cc]enter><b>|>Error</td>|>\(ERROR:)(?:\s*<.+?>\s*)*(.+?)(?:["\']|<|\))'
- OVR_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)'
- LINK_PATTERN = None #: final download url pattern
+ LEECH_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)'
+ LINK_PATTERN = None #: final download url pattern
CAPTCHA_PATTERN = r'(https?://[^"\']+?/captchas?/[^"\']+)'
CAPTCHA_DIV_PATTERN = r'>Enter code.*?<div.*?>(.+?)</div>'
RECAPTCHA_PATTERN = None
SOLVEMEDIA_PATTERN = None
+ FORM_PATTERN = None
+ FORM_INPUTS_MAP = None #: dict passed as input_names to parseHtmlForm
+
def setup(self):
self.chunkLimit = 1
@@ -143,7 +146,7 @@ class XFSHoster(SimpleHoster):
#only tested with easybytez.com
self.html = self.load("http://www.%s/" % self.HOSTER_DOMAIN)
- action, inputs = self.parseHtmlForm('')
+ action, inputs = self.parseHtmlForm()
upload_id = "%012d" % int(random() * 10 ** 12)
action += upload_id + "&js_on=1&utype=prem&upload_type=url"
@@ -184,11 +187,11 @@ class XFSHoster(SimpleHoster):
self.fail(stmsg)
#get easybytez.com link for uploaded file
- m = re.search(self.OVR_LINK_PATTERN, self.html)
+ m = re.search(self.LEECH_LINK_PATTERN, self.html)
if m is None:
- self.error(_("OVR_LINK_PATTERN not found"))
+ self.error(_("LEECH_LINK_PATTERN not found"))
- header = self.load(m.group(1).strip(), just_header=True, decode=True) #@TODO: Remove .strip() in 0.4.10
+ header = self.load(m.group(1), just_header=True, decode=True)
if 'location' in header: #: Direct download link
self.link = header['location']
@@ -257,10 +260,10 @@ class XFSHoster(SimpleHoster):
def getPostParameters(self):
- if hasattr(self, "FORM_PATTERN"):
- action, inputs = self.parseHtmlForm(self.FORM_PATTERN)
+ if self.FORM_PATTERN or self.FORM_INPUTS_MAP:
+ action, inputs = self.parseHtmlForm(self.FORM_PATTERN or "", self.FORM_INPUTS_MAP or {})
else:
- action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")})
+ action, inputs = self.parseHtmlForm(input_names={'op': re.compile(r'^download')})
if not inputs:
action, inputs = self.parseHtmlForm('F1')
@@ -311,8 +314,8 @@ class XFSHoster(SimpleHoster):
m = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.S)
if m:
captcha_div = m.group(1)
+ numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
self.logDebug(captcha_div)
- numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))])
self.logDebug("Captcha code: %s" % inputs['code'], numerals)
return 2
@@ -322,9 +325,10 @@ class XFSHoster(SimpleHoster):
captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1)
except:
captcha_key = recaptcha.detect_key()
+ else:
+ self.logDebug("ReCaptcha key: %s" % captcha_key)
if captcha_key:
- self.logDebug("ReCaptcha key: %s" % captcha_key)
inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
return 3
@@ -333,9 +337,10 @@ class XFSHoster(SimpleHoster):
captcha_key = re.search(self.SOLVEMEDIA_PATTERN, self.html).group(1)
except:
captcha_key = solvemedia.detect_key()
+ else:
+ self.logDebug("SolveMedia key: %s" % captcha_key)
if captcha_key:
- self.logDebug("SolveMedia key: %s" % captcha_key)
inputs['adcopy_challenge'], inputs['adcopy_response'] = solvemedia.challenge(captcha_key)
return 4