From 424488a3067c7ea8a8a4753013af79ad2d9f3c1a Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Sat, 12 May 2018 19:42:27 +0200 Subject: [PATCH] strip html from mastodon tootline --- screenless/bureau/publicrelations/publicrelations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/screenless/bureau/publicrelations/publicrelations.py b/screenless/bureau/publicrelations/publicrelations.py index 4c6cc7d..494308a 100644 --- a/screenless/bureau/publicrelations/publicrelations.py +++ b/screenless/bureau/publicrelations/publicrelations.py @@ -7,6 +7,7 @@ import textwrap import string import urllib +import bleach from escpos import printer import facebook from mastodon import Mastodon @@ -287,7 +288,7 @@ class PublicRelations(Bureau): prn._raw(username) prn.text("\r\n") prn.set(text_type="NORMAL") - ttext = html.unescape(t.content) + ttext = bleach.clean(t.content, strip=True) t_wrapped = textwrap.fill(ttext, width=48) + "\r\n" t_enc = t_wrapped.encode("cp437", "ignore") prn._raw(t_enc)