diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/keep-to-md.py b/keep-to-md.py new file mode 100644 index 0000000..670a050 --- /dev/null +++ b/keep-to-md.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +import os +import json +from datetime import datetime +txt = open('text.md', 'w', encoding='utf-8') +for file in os.listdir("E:\code\keep"): + if file.endswith(".json"): + with open(file, 'r', encoding='utf-8') as f: + text = json.load(f) + print(file) + if text['title'] != "": + txt.write('**' + text['title'] + '**' + '\n') + if 'textContent' in text: + txt.write(text['textContent'] + '\n') + if 'text' in text: + txt.write(text['text'] + '\n') + if 'labels' in text.keys(): + for i in text['labels']: + txt.write('`' + i['name'] + '`' + '\n') + ts = int(text['userEditedTimestampUsec'])//1000000 + t = datetime.utcfromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') + txt.write('`' + t + '`' + '\n\n---\n') \ No newline at end of file