diff --git a/README.md b/README.md index 1c7b3a2..af3bc34 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ -# Attention: It has been reported that the following methodology is no longer valid as it exports Starndard Notes in a new format. A pull request is needed to fix it. - ## Usage: ```bash -python3 standard-notes-to-enex.py SN_Archive.txt +python3 standard-notes-to-enex.py SN_Archive.zip ``` -If a name like `SN_Archive.txt` is not provided, the script will assume your file is called `notes.txt`. +If a name like `SN_Archive.zip` is not provided, the script will assume your file is called `notes.zip`. ## Tutorial diff --git a/standard-notes-to-enex.py b/standard-notes-to-enex.py index 5d93af9..7cac455 100755 --- a/standard-notes-to-enex.py +++ b/standard-notes-to-enex.py @@ -3,11 +3,12 @@ import html import datetime import re from sys import argv +import zipfile -source = argv[1] if len(argv) > 1 else 'notes.txt' - -data = json.load(open(source)) +source = argv[1] if len(argv) > 1 else 'notes.zip' +with zipfile.ZipFile(source, 'r') as zip_ref: + data = json.loads(zip_ref.read('Standard Notes Backup and Import File txt.txt').decode('utf-8')) def text_from_html(title, text): # Clear title @@ -65,6 +66,6 @@ final_file += '''''' # close root tag # Save -with open("notes.enex", "w") as text_file: +with open("notes.enex", "w", encoding='utf-8') as text_file: text_file.write(final_file)