Skip to content

Commit

Permalink
v1.0.3更新
Browse files Browse the repository at this point in the history
  • Loading branch information
XingzaiUnrivaled authored Oct 21, 2023
1 parent f562abf commit bff778c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

[MacOS 3.11.5 通用版](https://www.python.org/ftp/python/3.11.5/python-3.11.5-macos11.pkg)

MacOS 指令(前提是你装了包管理器,比如brew之类的,我印象里Mac自带python来着的)
MacOS 指令(前提是你装了包管理器,比如brew之类的,我印象里Mac自带来着的)

```shell
brew install python3
Expand Down Expand Up @@ -111,5 +111,8 @@ python3 novel_spider.py
话已至此,本项目仅供爬虫案例参考不要用于非法用途,如果有,与本人和本项目无关。

## 版本更新

* v1.0.3 更新路径从原来放到文件等同路径变成了对应了路径,单个txt放入 `./single txt/` 下,依次类推, `./multi txt/`
`./epub/`
* v1.0.2 更新部分文本,加入进度条,比之前的可视化更好,即使在命令行提示里面也加入书名号,由于加入了进度条需要再安装一个库,如果运行不起来就再跟着readme走一遍。
* v1.0.1 修复windows无法写入 `/:*?"<>|\` 这些字符到文件名内的问题,替换成 `丿:星?'《》丨、`
7 changes: 4 additions & 3 deletions novel_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_novel(bk_id, write_type=1):
book.add_item(epub.EpubNcx())
book.add_item(epub.EpubNav())
book.spine = spine
epub.write_epub("《" + novel_name + "》.epub", book)
epub.write_epub("epub/《" + novel_name + "》.epub", book)
print('EPUB文件生成成功!')
else:
print("由于选择的类型并不是1~3,所以不下载小说")
Expand Down Expand Up @@ -72,11 +72,12 @@ def store_content(package_name, url, length, t, book=None):
title = replace_special_character(title)
epub_result = li[2]
# print(f"当前为第{i}章")
# v1.0.3 更新路径
if t == 1:
filename = package_name + "/" + title + ".txt"
filename = "multi txt/"+package_name + "/" + title + ".txt"
write_file(filename, result, title)
elif t == 2:
write_in_one_file("《" + package_name + "》.txt", result, title)
write_in_one_file("single txt/《" + package_name + "》.txt", result, title)
elif t == 3:
chapter = epub.EpubHtml(title=title, file_name=title + '.xhtml',
content="<h1>" + title + "</h1>" + epub_result)
Expand Down

0 comments on commit bff778c

Please sign in to comment.