Merge branch 'master' into 'master'

Change LinkTitler to only post titles with a valid response

See merge request !1
This commit is contained in:
dave 2018-01-02 23:27:37 +00:00
commit cc8951f865
1 changed files with 2 additions and 1 deletions

View File

@ -140,7 +140,8 @@ class LinkTitler(ModuleBase):
data = data.decode('utf-8', "ignore")
titleMatches = re.findall(r'<title>([^<]+)</title>', data, re.I)
if len(titleMatches) > 0: # and resp.status_code==200:
statusCodeWhitelist = self.config.get("status_code_whitelist", [200])
if titleMatches and resp.status_code in statusCodeWhitelist:
h = html.parser.HTMLParser()
title = h.unescape(titleMatches[0]).strip()
if len(title) > 0: