Live data from Hacker News

Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

github.com

11–20 of 107 posts

Re: Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

#11
I am excited to see more solutions that work with Apple Notes database directly. This is my go-to application to capture unstructured memos while researching various topics. Last year I got carried away and built a simple site generator for Notes [0]. As a fun exercise I implemented ORM models to query Sqlite database in Ruby:

  User::Account.server(database: "tmp/test.sqlite").first.
    folders_dataset.offset(1).first
    notes.
    map(&:attachments).flatten.
    find { |el| el.is_a?(User::ObjectTypes::EmbeddedPublicJpeg) &&
      el.height > 700 &&
      el.summary[/animal/i] }.
    media_filepath
 => "Accounts//Media/F669B83A-0C47-408E-9645-015737F3B11F/Pasted Graphic.jpg"
Apple Notes' database structure is a fascinating product story. Notes started as a simple note-taking application that stored its content as raw HTML in a few simple tables. However, as the product grew and needed more features like collaboration, they had to make changes and add new columns and tables. They also implemented two flavors of CRDT-like algorithms that evolved over time: one for plaintext chunks and the other one for embedded objects like tables. On top of that, every change that Apple makes must be backward compatible to support legacy devices and systems; but backward-compatibility was not always possible and users had to go through “Migrate your Notes” steps, but it is again a product story.

I wish that one day, someone from the development team would write an article about it.

[0] https://devlog.notespub.com/2022/08/site-generator-for-apple...

Re: Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

#12
post #10

Cool! Thanks for sharing. Also worth noting that there's a Mac app in the app store to export to markdown or html: https://apps.apple.com/us/app/exporter/id1099120373?mt=12 (I haven't had a need yet, so I haven't tried it)

I have used it several times and it’s fantastic. Exports attachments into properly named media folders and everything.

Re: Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

#13

So now we know how to export data from the notes.app, messages.app & reminders.app. What’s next?

At https://support.apple.com/en-us/HT204055, Apple provides instructions for a bunch of stuff you might want to export:

  • iCloud Drive files
  • Photos and videos
  • Mail
  • Contacts
  • Calendar
  • Reminders
  • Safari
  • Notes
  • Voice Memos
And/or you can use https://privacy.apple.com/, which is basically Apple's version of Google Takeout.

Re: Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

#14
As a windows user, while we don't have an OS built-in equivalent, the standard for such tools (in the form of Sublime and the like) is just to operate with temporary buffers that get written out as files on user request. Sublime will write internal data to some persistent storage somewhere and be able to survive sudden crashes and restarts but when you'd like to save the data out to a fixed filepath it's pretty trivial to do so. I do find it quite weird that Apple has managed to cultivate a system where storage in separate files isn't taken as the default.

Re: Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

#15
I wrote a similar tool in Python a few weeks ago, which uses AppleScript to liberate the data and saves it to a SQLite database: https://datasette.io/tools/apple-notes-to-sqlite

I didn't actually know AppleScript before writing this tool... but it turned out ChatGPT knew it well enough to unblock me and provide me with exactly the code I needed to build the rest of the project! https://til.simonwillison.net/gpt3/chatgpt-applescript

Apple Notes Liberator creates a copy of the SQLite database and then runs queries against that directly to extract the data.

I chose not to do that (despite being all-in on SQLite for everything) because I worry about future changes to the software baking my script - I figured the AppleScript interface was less likely to have breaking changes in the future.

Re: Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

#16
I am excited to see more ways to export data out of Apple Notes. Long term it would be amazing to see a solution that allows more interoperability with other apps.

Depending on what you are looking to achieve there are a few ways to export Apple Notes to Markdown files, but it's only a one-way out solution.

From the Obsidian forum: https://forum.obsidian.md/t/import-from-apple-notes-to-obsid...

Re: Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

#17
This is great! How do you account for updates to a note?

I’ve been building an archiver tool as well to convert notes into markdown and post to git using Apple Shortcuts.

The interop between almost all iOS data formats (notes, safari, calendar, etc.) the content graph[0] provides is really impressive.

[0]: https://support.apple.com/en-me/guide/shortcuts/apd4618db957...

Re: Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

#18
post #8

Super interesting, particularly the link through to the blog with all the research into how Notes works. A particularly interesting thing that I don't see mentioned anywhere is that Apple Notes uses CRDTs (conflict free replicated data types) to enable both shared notes and multiple concurrent edits. With the CRDTs resolving the conflicts. It looks like the info on the page may be a good place to start looking to how…

CRDTs are definitely an “unsung hero” of Apple Notes… and a big reason why it is one Apple’s best “built-in” apps as of late.

If they could now implement table resizing and tables that do not render with graphical errors, that would be so nice.

Re: Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

#19
post #15

I wrote a similar tool in Python a few weeks ago, which uses AppleScript to liberate the data and saves it to a SQLite database: https://datasette.io/tools/apple-notes-to-sqlite I didn't actually know AppleScript before writing this tool... but it turned out ChatGPT knew it well enough to unblock me and provide me with exactly the code I needed to build the rest of the project! https://til.simonwillison.net/gpt3/chat…

I loved your post about the pelican! https://simonwillison.net/2020/May/21/dogsheep-photos/

Re: Show HN: Apple Notes Liberator – Extract Notes.app Data and Save It as JSON

#20
I have published an app [Exporter](https://apps.apple.com/us/app/exporter/id1099120373?mt=12) that does something similar - exports Apple Notes to HTML and markdown with the attachments. Give it a try, let me know if it solves your issue.

Also, why did you select JSON as the output format?

Post reply on HN