🧩 Extending OmniRead
OmniRead is meant to be extended by subclassing. All public extension points are generic over their result type, so your parser returns exactly the shape you need.
🧬 Custom parsers
Subclass BaseParser[T] (or a format parser) and implement parse():
The parsed page is validated by Pydantic on construction — no manual assertions required.
🧬 Custom PDF parsers
PDF binary layout is format-specific, so parsers return your own model:
🧬 Custom clients
Clients supply raw bytes to a scraper. For PDFs, subclass
BasePDFClient (or FileSystemPDFClient) and implement
fetch(source) -> bytes:
The same pattern applies to BaseCsvClient and BaseXlsxClient.
🚀 Custom scrapers
Festch something that a built-in scraper does not cover by extending
BaseScraper:
✅ Extension checklist
- Keep scraper and parser separate — never mix I/O into
parse(). - Return
Contentfrom any scraper/client so downstream stays uniform. - Return a typed result from your parser (Pydantic model, dataclass, str).
- Test your custom layers with a mock client, not a live network.
📚 Read Next
- How to Use — built-in example flows.
- Development — running tests and docs.