View Single Post
Old 08-25-2018, 03:26 PM   #36
retrography
Member
retrography is on a distinguished road
 
Posts: 23
Karma: 50
Join Date: Jul 2018
Location: Amsterdam
Device: Onyx Boox Max 2 / PocketBook Inkpad 3 / Kindle Paperwhite 3
Sample code

It is pretty easy to get to those annotations. Here is an idea:

That file (books.db) is a simple sqlite database. You can query it using any sqlite3 client, but to do it properly you need the json1 extension installed as well. Here is a sample query that gives you a neatly formatted html table (see attached):

Code:
echo "<HTML><BODY><TABLE>"$(sqlite3 --header --html books.db "select Title, Authors, json_extract(Highlight, '$.text') as Text from Books inner join (select OID as BookID, Highlight from Items inner join (select ParentID, Highlight from Items inner join (select ItemID, Val as Highlight from Tags where TagID = 104 and Val <> '{\"text\":\"Bookmark\"}') as Highlights on Highlights.ItemID = OID) as Highlights on Highlights.ParentID = OID) as Highlights on BookID = OID;")"</TABLE></BODY></HTML>" > highlights.html
You can extend this to extract other annotations (e.g. note, bookmark) as well as page/position number for each annotation.
Attached Files
File Type: zip hs.html.zip (18.2 KB, 700 views)

Last edited by retrography; 08-25-2018 at 03:32 PM.
retrography is offline   Reply With Quote