epublib.parse module

parse_container_file(
source: SourceProtocol,
) tuple[XMLResource, str]

Parse the container.xml file at the root of the document. Only consider the first rootfile. Return also the filename of the package document

Parameters:

source – The source to read the EPUB from.

Returns:

A tuple (container, package_fn) of the container XMLResource and the package document filename.

parse_package_document(
source: SourceProtocol,
filename: str,
) PackageDocument

Parse the package document (META-INF/container.xml)

init_resource(
source: SourceProtocol,
info: ZipInfo,
manifest_item: ManifestItem | None,
) Resource

Initialize a Resource object from a ZipInfo and optional ManifestItem

parse(
source: SourceProtocol,
) tuple[XMLResource, PackageDocument, list[Resource]]

Read and parse the EPUB file from the source