mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-29 02:53:42 +01:00
37 lines
894 B
Python
Executable File
37 lines
894 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import pandas as pd
|
|
from pandas import json_normalize
|
|
import json
|
|
from html import unescape
|
|
|
|
with open("/home/jas/downloads/outbox.json", "r") as jf:
|
|
json_data = json.load(jf)
|
|
|
|
flattened_df = json_normalize(json_data, record_path=["orderedItems"])
|
|
|
|
published = []
|
|
for item in flattened_df["object.published"]:
|
|
published.append(item)
|
|
|
|
content = []
|
|
for item in flattened_df["object.content"]:
|
|
content.append(item)
|
|
|
|
x = zip(published, content)
|
|
|
|
print("#+TITLE: Mastodon posts, 2024-02-16T15:48:46Z - 2024-10-11T20:15:03Z")
|
|
print("#+SETUPFILE: ../org-templates/page.org")
|
|
print()
|
|
for item in x:
|
|
if type(item[0]) is str:
|
|
print(f"*** {item[0]}")
|
|
|
|
if type(item[1]) is str:
|
|
print("#+BEGIN_QUOTE")
|
|
print("#+BEGIN_EXPORT html")
|
|
print(unescape(item[1]))
|
|
print("#+END_EXPORT")
|
|
print("#+END_QUOTE")
|
|
print()
|