Fix for case of multiple attachments

This commit is contained in:
Jeffrey Serio 2025-02-03 12:53:18 -06:00
parent 195ada61f6
commit 4fd2204326

View File

@ -23,7 +23,7 @@ def main():
published = item.get("object").get("published")
content = item.get("object").get("content")
attachment = (
item.get("object").get("attachment")[0]
item.get("object").get("attachment")
if len(item.get("object").get("attachment")) >= 1
else None
)
@ -34,11 +34,12 @@ def main():
print(unescape(content))
print("#+END_EXPORT")
if attachment:
if attachment.get("name"):
print(f"#+CAPTION: {attachment.get('name')}")
print(
f"[[https://files.hyperreal.coffee/mastodon_20240216-20250131/{attachment.get('url')}]]"
)
for item in attachment:
if item.get("name"):
print(f"#+CAPTION: {item.get('name')}")
print(
f"[[https://files.hyperreal.coffee/mastodon_20240216-20250131/{item.get('url')}]]"
)
print("-----")
print()