🧱 Overview
OmniRead is designed as a decoupled content engine with three distinct layers. Understanding them is the key to using and extending the library.
🏗️ Architecture
- Scraper (
BaseScraper) — fetches raw bytes from a source (HTTP URL, filesystem path, object storage). Returns aContentinstance. Scrapers never interpret content. - Content (
Content) — the canonical exchange model: raw bytes, source identifier, and optionalContentTypeenum. - Parser (
BaseParser[T]) — receives aContentand returns a structured result of typeTviaparse().
📦 The Content model
Defined in omniread.core.content:
raw— the raw bytes exactly as retrieved.source— URL, file path, or logical name identifying the origin.content_type— optionalContentTypeenum value.
🎭 The ContentType enum
| Value | MIME | Used by |
|---|---|---|
HTML |
text/html |
HTMLScraper |
PDF |
application/pdf |
PDFScraper |
XLSX |
application/vnd.openxmlformats-... |
XlsxScraper |
CSV |
text/csv |
CsvScraper |
JSON |
application/json |
— |
XML |
application/xml |
— |
🧩 Format modules at a glance
| Module | Scraper | Parser | Client | Notes |
|---|---|---|---|---|
omniread.html |
HTMLScraper |
HTMLParser |
— | httpx + BeautifulSoup |
omniread.pdf |
PDFScraper |
PDFParser |
FileSystemPDFClient |
explicit client layer |
omniread.csv |
CsvScraper |
CsvParser |
FileSystemCsvClient |
stdlib csv module |
omniread.xlsx |
XlsxScraper |
XlsxParser |
FileSystemXlsxClient |
openpyxl-backed |
📚 Read Next
- How to Use — working examples per format.
- Extending OmniRead — subclassing scrapers and parsers.