social media crossposting tool. 3rd time's the charm
mastodon misskey crossposting bluesky

fix: -1 call on a possibly empty list

zenfyr.dev 3fe345ab 73f2464b

verified
Changed files
+6
+6
mastodon.py
···
md_parser.preserve_spaces = True
def tokenize_post(status: dict) -> list[cross.Token]:
+
if not status.get('content'):
+
return []
+
soup = BeautifulSoup(status['content'], "html.parser")
tokens: list[cross.Token] = []
···
for child in soup.contents:
recurse(child)
+
+
if not tokens:
+
return []
last_token = tokens[-1]
if last_token and isinstance(last_token, cross.TextToken) and last_token.text.endswith('\n\n'):