|
|
#1 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
|
Hellj
Is there a simple tool (for Windows), that could grab the notes from an EPUB file once it's connected through USB, and append them to a local TXT file? I found that, after adding a note, each .epub file has a corresponding file in "\Digital Editions\Annotations\blah.epub.annot", but that XML file only contains links to annotions, not the annotations themselves: Code:
<annotation> <dc:identifier>urn:uuid:de120535-d147-4f21-bbb6-3da9ba9dc7a9</dc:identifier> <dc:date>2026-01-11T02:58:19Z</dc:date> <dc:creator>urn:uuid:374c8101-17fe-41c5-b9c7-0f4d8a6833f5</dc:creator> <target> <fragment start="OEBPS/ch01.html#point(/1/2/1/18/9/1:260)" end="OEBPS/ch01.html#point(/1/2/1/18/9/1:260)" progress="0.0922619" color="0"/> </target> </annotation>
I currently use the medieval solution of… shooting screenshots with my smartphone and copy/pasting the PNGs to my computer before possibly grabbing the actual text from the EPUB after searching the file through CTRL+F and pasting it to a TXT if I need to :-/ Thank you. Last edited by Shohreh; 02-19-2026 at 05:46 AM. |
|
|
|
|
|
#2 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 82,179
Karma: 150871427
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Using calibre, you give ths Annotations and/or Kobo Utilities plugins a try to get your annotations.
Annotations - https://www.mobileread.com/forums/sh...d.php?t=241206 Kobo Utilities - https://www.mobileread.com/forums/sh...d.php?t=366110 |
|
|
|
|
|
#3 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
|
Thanks. Can it be used through the CLI, so I can call it through a batch file instead of loading the GUI?
|
|
|
|
|
|
#4 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 82,179
Karma: 150871427
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
|
|
|
|
|
#5 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
|
I'll see if it supports it, thx
|
|
|
|
|
|
#6 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
|
It looks like all the highlights ("annotations") are appended to XML files under \Digital Editions\Annotations\, so there's no need to use an external app like Calibre or KOreader — a simple Python script with BeautifulSoup will take care of business:
\Digital Editions\Annotations\myfile.epub.annot: Code:
<annotation> <dc:identifier>urn:uuid:4fe72a8f-81d1-4b15-a5ea-7552f68295eb</dc:identifier> <dc:date>2026-01-14T22:36:13Z</dc:date> <dc:creator>urn:uuid:374c8101-17fe-41c5-b9c7-0f4d8a6833f5</dc:creator> <target> <fragment start="text/part0015.html#point(/1/4/65/4:1)" end="text/part0015.html#point(/1/4/66:0)" progress="0.122371" color="4"> <text>stuff I highlited</text> </fragment> </target> </annotation> Edit: First draft Code:
import wx
from bs4 import BeautifulSoup
import shortuuid
import pathlib
import sys
DEFDIR = 'd:/Digital Editions/Annotations/'
# Zack Gainsforth 2014
def FileDialog(DefaultDir=DEFDIR, Title='Select File:', Extension='*.annot'):
dlg = wx.FileDialog (None, Title, DefaultDir, '', Extension, wx.FD_DEFAULT_STYLE | wx.FD_FILE_MUST_EXIST)
if dlg.ShowModal() == wx.ID_OK:
FileName = dlg.GetPath()
else:
FileName = None
dlg.Destroy()
return FileName
if 'app' not in locals():
app = wx.App(None)
INPUT = FileDialog()
BASENAME = pathlib.Path(INPUT).stem
uuid = shortuuid.ShortUUID().random(length=8)
OUTPUTDIR = sys.path[0]
OUTPUTFILE = f"{OUTPUTDIR}/{BASENAME}.{uuid}.annot"
soup = BeautifulSoup(open(INPUT, 'r',encoding='utf-8'), features='xml')
title = soup.find("dc:title").text if soup.find("dc:title") else "No title"
print(title)
if soup.find("annotation"):
for annot in soup.find_all("annotation"):
#<fragment start="text/part0015.html#point(/1/4/65/4:1)" end="text/part0015.html#point(/1/4/66:0)" progress="0.122371" color="4">
#assume highlight located in single file within EPUB
location= annot.target.fragment["start"].split(".html")[0]
print(location)
text = annot.target.text.strip() + "\n========"
print(text)
with open(f"{OUTPUTFILE}","a") as f:
f.write(f"{location}\n")
f.write(f"{text}\n")
else:
print("No highlight")
-- Edit: Oddly, the highlights are now gone from the *.annot files under \Digital Editions\Annotations\ And when running "select count(*) from Bookmark;" from the \.kobo\KoboReader.sqlite database, SQLite ends with "Runtime error: database disk image is malformed (11)". They can be found after recovering the DB through "sqlite3 KoboReader.sqlite .recover >data.sql ; sqlite3 fixed.sqlite <data.sql", but 1) I shouldn't need to do this, and 2) the lost_and_found table contains 101 columns from c0 to c100 :-/ Code:
select rootpgno,trim(c9) from lost_and_found where c1 LIKE '%My Author%' AND c9 IS NOT NULL AND TRIM(c9,' ') != ''; Edit: Per this post, I rebooted before copying the DB file to the computer… and the SELECT worked to list highlights: Code:
sqlite3 KoboReader.sqlite select VolumeID, Text from Bookmark WHERE Text IS NOT NULL AND Text != ''; To check the integrity of a SQLite DB: Code:
c:\temp\sqlite3 KoboReader.sqlite PRAGMA integrity_check; Edit: There's a solution that 1) doesn't require installing anything, and 2) exports annotations into text files, so you can then remove the book and they'll still be available — which isn't true of the KoboReader.sqlite file: I noticed that once a book is removed from the Kobo, annotations will also be gone. 1. Connect the Kobo the computer with a (reliable) USB cable 2. Open "\.kobo\Kobo\Kobo eReader.conf" in a text editor, eg. Notepad 3. Search for the following section, add it if not found: Code:
[FeatureSettings] ExportHighlights=true 5. Highlight a section in a book, close it, long-press the book in the list, choose "Export annotations": They will exported as a .txt file 6. Re-connect the Kobo to the computer: Annotations are located in \Exported Annotations\ Sources: https://www.reddit.com/r/kobo/commen...mment/lk6k4ro/ https://wiki.mobileread.com/wiki/Kob...ration_Options -- Edit: One book with more hightlights was semi-SQLite garbage (see attachment). I had to reboot the Kobo and re-export the annotations for the text file to be kosher. I'll give KoReader a try Last edited by Shohreh; 02-19-2026 at 05:58 AM. |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to have a copy of my files in my computer | mitra1 | Onyx Boox | 1 | 03-06-2021 07:47 AM |
| Copy and paste of PDF notes | Jantah | Onyx Boox | 0 | 06-23-2020 10:13 AM |
| copy text to computer clipboard | alansplace | Editor | 13 | 02-03-2014 12:35 PM |
| Help-copy from ipad to computer | Beerman | Devices | 3 | 10-12-2011 06:01 AM |
| How do I move notes to computer? | nguirado | Amazon Kindle | 8 | 12-27-2010 07:03 PM |