| filecreated | 2025-04-06 | |
|---|---|---|
| fileupdated | 2025-04-06 | |
| filetags |
|
This repository contains scripts for extracting highlights, annotations and notes from a Kobo e-reader's SQLite database (KoboReader.sqlite).
kobo_exporter_web.py: A zero-dependency Python web application to browse backup ZIP files, extract.kobo/KoboReader.sqlite, and export annotations/notes into a Markdown file. Features a rich, modern Web UI with glassmorphism and automatic browser launch.kobo-export.py(referenced asextract_kobo.py): A Python script to extract annotations and highlights, handle line breaks, exclude "dogear" entries, and group the output by book in a Markdown file. The book titles are sorted alphabetically in the output.kobo-export.sh(referenced asextract_kobo.sh): A Bash script to extract highlights, annotations and notes and format them in Markdown. It takes the database file as an argument and outputs to a dated Markdown file.kobo-annotation-stats.py(referenced askobo_annotation_stats.py): A Python script to analyze the Kobo database and list the books with highlights or notes, along with a count of each for each book..gitignore: Specifies intentionally untracked files that Git should ignore. Currently ignores.sqland.mdfiles.
- Save the script: Save the
extract_kobo.pyfile to your local machine. - Make it executable (optional):
chmod +x extract_kobo.py
- Run the script: Execute the script from your terminal, providing the path to your
KoboReader.sqlitefile as a command-line argument:or if you made it executable:python extract_kobo.py /path/to/KoboReader.sqlite
./extract_kobo.py /path/to/KoboReader.sqlite
- Output: The script will create a Markdown file named
kobo_annotations_by_book_YYYY-MM-DD.md(whereYYYY-MM-DDis the current date) in the same directory where you run the script. This file will contain your annotations grouped under book titles, sorted alphabetically. Line breaks within the highlighted text and notes will be replaced with underscores. "dogear" type entries are excluded.
- Save the script: Save the
extract_kobo_notes.shfile to your local machine. - Make it executable:
chmod +x extract_kobo_notes.sh
- Run the script: Execute the script from your terminal, providing the path to your
KoboReader.sqlitefile as a command-line argument:./extract_kobo_notes.sh /path/to/KoboReader.sqlite
- Output: The script will create a Markdown file named
kobo_annotations_YYYY-MM-DD.md(whereYYYY-MM-DDis the current date) in the same directory where you run the script. This file will contain your annotations. Line breaks within the highlighted text and notes will be replaced with underscores. "dogear" type entries are excluded.
- Save the script: Save the
kobo_annotation_stats.pyfile to your local machine. - Make it executable (optional):
chmod +x kobo_annotation_stats.py
- Run the script: Execute the script from your terminal, providing the path to your
KoboReader.sqlitefile as a command-line argument:or if you made it executable:python kobo_annotation_stats.py /path/to/KoboReader.sqlite
./kobo_annotation_stats.py /path/to/KoboReader.sqlite
- Output: The script will print a list to your terminal showing each book in your Kobo library that has highlights or notes, along with the count of highlights and notes for that book.
- Make it executable (optional):
chmod +x kobo_exporter_web.py
- Run the application:
or:
python kobo_exporter_web.py
./kobo_exporter_web.py
- Usage:
Your default web browser will automatically open to
http://127.0.0.1:8000(or the first available port if 8000 is in use).- Use the visual file explorer to browse and click on your Kobo backup
.zipfile. - Choose an alternative output directory if desired (defaults to the directory from which the script was launched).
- Click Export Annotations.
- Use the visual file explorer to browse and click on your Kobo backup
The .gitignore file in this repository is configured to ignore:
*.sql: Any files ending with the.sqlextension. This is useful if you run direct SQL queries and don't want those files tracked.kobo_annotations*.md: Anykobo_annotationfiles ending with the.mdextension. This is to prevent the generated Markdown output files from being tracked by Git. If you want to track your generated annotation files, you should remove this line from.gitignore.
These scripts are designed to help Kobo e-reader users extract their valuable highlights, annotations and notes from the device's database into a readable Markdown format for backup, personal knowledge management, or further processing. The Python script offers the added benefit of grouping annotations by book and sorting them alphabetically.