fix: 替换过时的 X-XSS-Protection 为 Content-Security-Policy
This commit is contained in:
@@ -40,11 +40,16 @@ class EPUBSplitter:
|
||||
extracted_chapters = []
|
||||
for item in book.get_items_of_type(ebooklib.ITEM_DOCUMENT):
|
||||
try:
|
||||
# ebooklib 的 get_content() 返回 bytes
|
||||
content = item.get_content().decode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
logger.warning("EPUB 跳过一个无法解码的章节: %s", item.get_name())
|
||||
continue
|
||||
try:
|
||||
content = item.get_content().decode("utf-8-sig")
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
content = item.get_content().decode("latin-1")
|
||||
except UnicodeDecodeError:
|
||||
logger.warning("EPUB 跳过一个无法解码的章节: %s", item.get_name())
|
||||
continue
|
||||
|
||||
# 用 BeautifulSoup 去标签(如果可用),否则保留原样
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user