将 Apple Notes 导出到 SQLite
使用 pip
安装此工具
pip install apple-notes-to-sqlite
如需帮助,运行
apple-notes-to-sqlite --help
您也可以使用
python -m apple_notes_to_sqlite --help
要将您的笔记保存到名为 notes.db
的 SQLite 数据库,请运行
apple-notes-to-sqlite notes.db
将显示一个进度条。
您可以使用 --stop-after
在指定数量的笔记后停止它
apple-notes-to-sqlite notes.db --stop-after 10
要将笔记作为换行符分隔的 JSON 格式输出到标准输出,而不是保存到数据库,请使用 --dump
选项
apple-notes-to-sqlite --dump
此工具生成的数据库结构如下所示
CREATE TABLE [folders] (
[id] INTEGER PRIMARY KEY,
[long_id] TEXT,
[name] TEXT,
[parent] INTEGER,
FOREIGN KEY([parent]) REFERENCES [folders]([id])
);
CREATE TABLE [notes] (
[id] TEXT PRIMARY KEY,
[created] TEXT,
[updated] TEXT,
[folder] INTEGER,
[title] TEXT,
[body] TEXT,
FOREIGN KEY([folder]) REFERENCES [folders]([id])
);
CREATE UNIQUE INDEX [idx_folders_long_id]
ON [folders] ([long_id]);
Usage: apple-notes-to-sqlite [OPTIONS] [DB_PATH]
Export Apple Notes to SQLite
Example usage:
apple-notes-to-sqlite notes.db
This will populate notes.db with 'notes' and 'folders' tables containing all
of your notes.
Options:
--version Show the version and exit.
--stop-after INTEGER Stop after this many notes
--dump Output notes to standard output
--schema Create database schema and exit
--help Show this message and exit.
要为此工具做贡献,首先检出代码。然后创建一个新的虚拟环境
cd apple-notes-to-sqlite
python -m venv venv
source venv/bin/activate
现在安装依赖项和测试依赖项
pip install -e '.[test]'
运行测试
pytest