Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #18 from weiwei-cool/main
Browse files Browse the repository at this point in the history
紧急修复bug
  • Loading branch information
weiwei-cool authored Oct 28, 2023
2 parents 27bcbb0 + f0e1bd7 commit 6b29a9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/fanqie_epub.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
无论您对程序进行了任何操作,请始终保留此信息。
"""
import os

# 导入必要的模块
import requests
Expand Down Expand Up @@ -83,6 +84,9 @@ def fanqie_epub(url, user_agent, path_choice, start_chapter_id):
# 创建一个封面图片
book.set_cover("image.jpg", open('cover.jpg', 'rb').read())

# 删除封面
os.remove('cover.jpg')

# 设置书的元数据
book.set_title(title)
book.set_language('zh-CN')
Expand Down
14 changes: 7 additions & 7 deletions src/fanqie_normal.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ def fanqie_n(url, encoding, user_agent, path_choice, data_folder, start_chapter_
# 提取文章标签中的文本
chapter_text = re.search(r"<article>([\s\S]*?)</article>", chapter_content).group(1)

# # 将 <p> 标签替换为换行符
# chapter_text = re.sub(r"<p>", "\n", chapter_text)
#
# # 去除其他 html 标签
# chapter_text = re.sub(r"</?\w+>", "", chapter_text)
#
# chapter_text = p.fix_publisher(chapter_text)
# 将 <p> 标签替换为换行符
chapter_text = re.sub(r"<p>", "\n", chapter_text)

# 去除其他 html 标签
chapter_text = re.sub(r"</?\w+>", "", chapter_text)

chapter_text = p.fix_publisher(chapter_text)

# 在小说内容字符串中添加章节标题和内容
content += f"\n\n\n{chapter_title}\n{chapter_text}"
Expand Down

0 comments on commit 6b29a9e

Please sign in to comment.