28 lines
798 B
Python
28 lines
798 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
from pandas import json_normalize
|
||
|
import json
|
||
|
from html import unescape
|
||
|
|
||
|
|
||
|
def main():
|
||
|
with open("/home/jas/downloads/outbox.json", "r") as jf:
|
||
|
json_data = json.load(jf)
|
||
|
|
||
|
flattened_df = json_normalize(json_data, record_path=["orderedItems"])
|
||
|
|
||
|
for item in flattened_df.iterrows():
|
||
|
print(f"*** {item[1]["object.published"]}")
|
||
|
if type(item[1]["object.content"]) is str:
|
||
|
print("#+BEGIN_QUOTE")
|
||
|
print("#+BEGIN_EXPORT html")
|
||
|
print(unescape(item[1]["object.content"]))
|
||
|
print("#+END_EXPORT")
|
||
|
if item[1]["object.attachment"]:
|
||
|
if type(item[1]["object.attachment"]) is list:
|
||
|
for i in item[1]["object.attachment"]:
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|