strip html from mastodon tootline

workspace
Brendan Howell 7 years ago
parent da4afbd261
commit 424488a306

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

Loading…
Cancel
Save