use ebooklib to parse a tree-like structure from ebooks from the TOC
Project description
ebook-tree-parser
use ebooklib to parse a tree-like structure from ebooks from the TOC
Usage
from ebooklib import epub
from ebook_tree_parser.toctree import TocTree
file = "../data/frankenstein.epub"
book = epub.read_epub(file, options={'ignore_ncx': False})
estimator = lambda string: len(string)*4
tree = TocTree(book, token_estimator=estimator)
print(tree)
for node in tree3:
print("----")
print(f"{node.title}|{node.content_token_count}\n{node.content[:50]}")
print("----")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for ebook_tree_parser-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ee3f263fe4d6ca8c400ca4df91005166484456fae6a78d82be87a9e3f704918 |
|
MD5 | 1445a2aeef5c54b12acc93ad3089278c |
|
BLAKE2b-256 | f13ec745749c65bade7c16ac97e2f2fe7278106960f858efc4818d1cf77dde54 |