Skip to content

About

Kobo Reader annotation extract scripts

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

filecreated 2025-04-06
fileupdated 2025-04-06
filetags
readme

Kobo Annotation and Highlight Extractor

This repository contains scripts for extracting highlights, annotations and notes from a Kobo e-reader's SQLite database (KoboReader.sqlite).

Files

  • 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 as extract_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 as extract_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 as kobo_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 .sql and .md files.

Usage

Python Script (extract_kobo.py)

  1. Save the script: Save the extract_kobo.py file to your local machine.
  2. Make it executable (optional):
    chmod +x extract_kobo.py
  3. Run the script: Execute the script from your terminal, providing the path to your KoboReader.sqlite file as a command-line argument:
    python extract_kobo.py /path/to/KoboReader.sqlite
    or if you made it executable:
    ./extract_kobo.py /path/to/KoboReader.sqlite
  4. Output: The script will create a Markdown file named kobo_annotations_by_book_YYYY-MM-DD.md (where YYYY-MM-DD is 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.

Bash Script (extract_kobo.sh)

  1. Save the script: Save the extract_kobo_notes.sh file to your local machine.
  2. Make it executable:
    chmod +x extract_kobo_notes.sh
  3. Run the script: Execute the script from your terminal, providing the path to your KoboReader.sqlite file as a command-line argument:
    ./extract_kobo_notes.sh /path/to/KoboReader.sqlite
  4. Output: The script will create a Markdown file named kobo_annotations_YYYY-MM-DD.md (where YYYY-MM-DD is 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.

Python Script (kobo_annotation_stats.py)

  1. Save the script: Save the kobo_annotation_stats.py file to your local machine.
  2. Make it executable (optional):
    chmod +x kobo_annotation_stats.py
  3. Run the script: Execute the script from your terminal, providing the path to your KoboReader.sqlite file as a command-line argument:
    python kobo_annotation_stats.py /path/to/KoboReader.sqlite
    or if you made it executable:
    ./kobo_annotation_stats.py /path/to/KoboReader.sqlite
  4. 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.

Web Application (kobo_exporter_web.py)

  1. Make it executable (optional):
    chmod +x kobo_exporter_web.py
  2. Run the application:
    python kobo_exporter_web.py
    or:
    ./kobo_exporter_web.py
  3. 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 .zip file.
    • Choose an alternative output directory if desired (defaults to the directory from which the script was launched).
    • Click Export Annotations.

.gitignore

The .gitignore file in this repository is configured to ignore:

  • *.sql: Any files ending with the .sql extension. This is useful if you run direct SQL queries and don't want those files tracked.
  • kobo_annotations*.md: Any kobo_annotation files ending with the .md extension. 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.

Purpose

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.

About

Kobo Reader annotation extract scripts

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages