Books Annotations App

The Books app on iPhone (previously named iBooks) allows you to highlight text and leave notes. Unfortunately there's no good way to export these, as the information isn't stored in the ePubs themselves. The information is saved in the Media folder though, which is accessible from iPhones over USB. I built an app to read this into a searchable UI without having to install a bunch of software or pore through full backups.

You can download the Mac app here or check out the code on Github. This was the kind of perfect storm for making an app with Electron because it's a pretty wrapper that cobbles together stuff that mostly exists (libimobiledevice should make this somewhat trivial, although trying to find an easy way to invoke just the bits I need without installing a lot of code was distinctly non-trivial). This is the third app I've made with Electron (preceded by an iTunes to Spotify playlist converter and a Markov chain generator for texts) and the dev experience is still remarkably smooth for one-offs like this.

I really wish that Mac had a better public API for doing stuff like this. It's all reverse-engineered from how iTunes does it and involves passing structs with magic strings like CFA6LPAA (ironically that string is how I ended up finding some of the Node JS libraries on GitHub). After some inelegant pathways through iExplorer, ifuse, pymobiledevice3, and appium-ios-device I finally landed on libijs, albeit with a lot of gutting and fixing outdated imports. After that got working the hardest part was actually implementing search. Electron exposes findInPage from Chromium (which doesn't support only searching part of the page unfortunately, I only just clawed myself back from trying to PR the functionality) but it's a little buggy for paginating and took some tweaking for how to trigger moving back and forth (future me: don't listen to the 'Enter' keycode on the search input, listen on the overall window).

From such humble beginnings!