From 5141a0dc174a3f3f6a303196aa19db9377340b91 Mon Sep 17 00:00:00 2001 From: nemunaire Date: Fri, 23 Oct 2015 23:18:05 +0200 Subject: [PATCH] tools/web: simplify regexp and typo --- nemubot/tools/web.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nemubot/tools/web.py b/nemubot/tools/web.py index 15f7885..95854f8 100644 --- a/nemubot/tools/web.py +++ b/nemubot/tools/web.py @@ -203,7 +203,7 @@ def striphtml(data): data -- the string to strip """ - if not isinstance(data, str) and not isinstance(data, buffer): + if not isinstance(data, str) and not isinstance(data, bytes): return data try: @@ -232,6 +232,5 @@ def striphtml(data): import re - r, _ = re.subn(r' +', ' ', - unescape(re.sub(r'<.*?>', '', data)).replace('\n', ' ')) - return r + return re.sub(r' +', ' ', + unescape(re.sub(r'<.*?>', '', data)).replace('\n', ' '))