From 52dfe9e42c27ca3bb6c3ef28efac67ce6f6070f3 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 11 Sep 2023 07:40:16 +0100 Subject: [PATCH] Handle newlines in title HTML. --- check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check.py b/check.py index 31ae4d7..ff109fe 100755 --- a/check.py +++ b/check.py @@ -9,7 +9,7 @@ from email.utils import formatdate, make_msgid import requests -re_title = re.compile("(.*?)") +re_title = re.compile("(.*?)", re.DOTALL) AGENT = "Mozilla/5.0 (Windows NT 6.1) Gecko/20100101 Firefox/29.0" headers = {"User-Agent": AGENT, "Accept": "text/html"} @@ -56,7 +56,7 @@ def find_not_here_message(html: str) -> str | None: def get_title(html: str) -> str: """Title from web page.""" m = re_title.search(html) - return m.group(1) if m and m.group(1) else "no title" + return m.group(1).strip() if m and m.group(1) else "no title" def check_conference(name: str, url: str) -> tuple[bool, str]: