main
Александр Майоров 2023-11-12 09:49:32 +03:00
parent 039ec82c93
commit be8ac2a728
2 changed files with 23 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.DS_Store

22
keep-to-md.py Normal file
View File

@ -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')