From 7fcec206b01a12d3fa53adb37eb956041ac65566 Mon Sep 17 00:00:00 2001 From: Amber Date: Mon, 21 Mar 2022 22:18:06 -0500 Subject: [PATCH] partially fixed misskey scraping. Stolen from Grumbulon's fedi-books fork, commit e58c24bf0a --- functions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions.py b/functions.py index 04534a2..19c5349 100755 --- a/functions.py +++ b/functions.py @@ -37,7 +37,7 @@ def make_sentence(output, cfg): sentence = None tries = 0 while sentence is None and tries < 10: - sentence = model.make_short_sentence(500, tries=10000) + sentence = model.make_short_sentence(500, 200, tries=10000) tries = tries + 1 # optionally remove mentions @@ -68,10 +68,10 @@ def extract_toot(toot): toot = html.unescape(toot) # convert HTML escape codes to text soup = BeautifulSoup(toot, "html.parser") for lb in soup.select("br"): # replace
with linebreak - lb.replace_with("\n") + lb.name = "\n" for p in soup.select("p"): # ditto for

- p.replace_with("\n") + lb.name = "\n" for ht in soup.select("a.hashtag"): # convert hashtags from links to text ht.unwrap()