Skip to content
Back to skills

899 Feature Epub Extractor 7ae911c8

ASecurity

Technical design for the EPUB extraction module.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
developmentapi

Works with

  • api

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 899-feature-epub-extractor_7ae911c8 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 899 Feature Epub Extractor 7ae911c8?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 899 Feature Epub Extractor 7ae911c8
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-899-feature-epub-extractor-7ae911c8/badge)](https://www.skillsdirectory.com/skills/tools-only-899-feature-epub-extractor-7ae911c8)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
phase: design
title: System Design - EPUB Extractor
description: Technical design for the EPUB extraction module.
---

# System Design & Architecture

## Architecture Overview
**What is the high-level system structure?**

The `epub_extractor` mirrors the `pdf_extractor` in interface, providing a unified way to get "clean" text from a book file.

```mermaid
graph LR
    EPUB[EPUB File] --> EbookLib[EbookLib]
    EbookLib --> BeautifulSoup[BeautifulSoup4]
    BeautifulSoup --> Extractor[epub_extractor.py]
    Extractor --> Canonicalizer[text_canonicalizer.py]
    Canonicalizer --> Output[Clean Text]
```

## Data Models
**What data do we need to manage?**

- **EPUBContent:** The resulting string of clean text.
- **Metadata:** Dictionary containing title, author, and publisher.

## API Design
**How do components communicate?**

### Primary Interface
- `class EPUBExtractor`:
    - `__init__(file_path: Path)`
    - `get_full_text() -> str`
    - `iter_chapters() -> Iterator[str]` (Yields cleaned text per chapter)
    - `get_metadata() -> dict`

## Component Breakdown
**What are the major building blocks?**

- **EPUB Reader:** Wrapper around `ebooklib` to navigate the spine. Must explicitly filter for `ITEM_DOCUMENT` to avoid binary files.
- **HTML Purifier:** Uses `BeautifulSoup` with `get_text(separator=' ', strip=True)` to ensure words don't stick together after tag removal.
- **Bridge to Canonicalizer:** Pipe every chapter through the `canonicalize` function.

## Design Decisions
**Why did we choose this approach?**

- **EbookLib:** The most robust library for handling EPUB spine and manifest.
- **BeautifulSoup4:** Superior to regex for HTML stripping, handles malformed markup gracefully.
- **Character-based comparison:** By canonicalizing both PDF and EPUB to the same string format, we can use the same `CompletenessChecker`.

## Non-Functional Requirements
**How should the system perform?**

- **Robustness:** Gracefully handle missing manifest items or malformed XHTML.
- **Memory:** Process chapters as an iterator to avoid loading huge books entirely into memory if needed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.