View Single Post
Old 11-22-2023, 12:40 PM   #5
jmwu
Junior Member
jmwu began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Nov 2023
Device: pc
Quote:
Originally Posted by Turtle91 View Post
nice!

Do you have access to the individual xhtml/image/css/ncz files so you can read the text into a variable and manipulate with soup/re/etc.???
Yes, you can do this, just open and read.

# read text data
text = book.manifest.open("index.xhtml").read()
# read binary data
data = book.manifest.open("cover.png", "rb").read()

Additionally, you can open any of the files in the epub and it will return a file object. You can directly manipulate this file object. If you only change one byte, it will actually change one byte, which is very beneficial for handling very large files.
jmwu is offline   Reply With Quote