Browse Source

Merge branch 'master' into 'master'

Change LinkTitler to only post titles with a valid response

See merge request !1
dave/xdcc
dave 5 years ago
parent
commit
cc8951f865
  1. 3
      pyircbot/modules/LinkTitler.py

3
pyircbot/modules/LinkTitler.py

@ -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:

Loading…
Cancel
Save