mirror of
https://github.com/yihong0618/bilingual_book_maker.git
synced 2025-06-05 19:15:34 +00:00
fix: fix parser error of xml based epub (#50)
* fix: fix parser error of xml based epub * fix: fix xhtml based epub error by detect automatically * docs: update README
This commit is contained in:
parent
602ac2ca3e
commit
7200da7b0b
@ -162,9 +162,12 @@ class BEPUB:
|
||||
new_book.toc = self.origin_book.toc
|
||||
all_items = list(self.origin_book.get_items())
|
||||
# we just translate tag p
|
||||
all_p_length = sum(
|
||||
[len(bs(i.content, "html.parser").findAll("p")) for i in all_items]
|
||||
)
|
||||
all_p_length = 0
|
||||
for i in all_items:
|
||||
if i.file_name.endswith(".xhtml"):
|
||||
all_p_length += len(bs(i.content, "html.parser").findAll("p"))
|
||||
else:
|
||||
all_p_length += len(bs(i.content, "xml").findAll("p"))
|
||||
if IS_TEST:
|
||||
pbar = tqdm(total=TEST_NUM)
|
||||
else:
|
||||
|
@ -3,4 +3,4 @@ openai
|
||||
requests
|
||||
ebooklib
|
||||
rich
|
||||
tqdm
|
||||
tqdm
|
Loading…
x
Reference in New Issue
Block a user