File: epub_parse.py

package info (click to toggle)
python-ebooklib 0.15~ds0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 468 kB
  • ctags: 258
  • sloc: python: 1,611; sh: 166; makefile: 137
file content (23 lines) | stat: -rw-r--r-- 461 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys

import ebooklib
from ebooklib import epub
from ebooklib.utils import debug

book = epub.read_epub(sys.argv[1])

debug(book.metadata)
debug(book.spine)
debug(book.toc)

#for it in book.items:
#    debug( it.get_type())

for x in  book.get_items_of_type(ebooklib.ITEM_IMAGE):
    debug( x)

from ebooklib.plugins import standard, tidyhtml

opts = {'plugins': [standard.SyntaxPlugin(), tidyhtml.TidyPlugin()]}

epub.write_epub('test.epub', book, opts)