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

Commit

Permalink
维护代码,移除epub模式自定义起始章节功能
Browse files Browse the repository at this point in the history
  • Loading branch information
weiwei-cool committed Oct 29, 2023
1 parent 52ddde4 commit 0575b6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/fanqie_epub.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


# 定义正常模式用来下载番茄小说的函数
def fanqie_epub(url, user_agent, path_choice, start_chapter_id):
def fanqie_epub(url, user_agent, path_choice):
headers = {
"User-Agent": user_agent
}
Expand Down Expand Up @@ -125,7 +125,7 @@ def fanqie_epub(url, user_agent, path_choice, start_chapter_id):
for i, chapter in enumerate(chapters):
chapter_url_tmp = urljoin(url, chapter.find("a")["href"])
chapter_id_tmp = re.search(r"/(\d+)", chapter_url_tmp).group(1)
if chapter_id_tmp == start_chapter_id: # 将 开始索引设置为用户的值
if chapter_id_tmp == '0': # epub模式不支持起始章节
start_index = i

# 定义目录索引
Expand Down
7 changes: 4 additions & 3 deletions src/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def start():
elif choice == '2':
mode = 2
clear_screen()
print("您已进入自动批量下载模式(测试);")
print("您已进入自动批量下载模式:")
break
elif choice == '3':
mode = 3
Expand Down Expand Up @@ -239,7 +239,8 @@ def get_parameter(retry):
# 当用户按下Ctrl+C是,可以自定义起始章节id
except KeyboardInterrupt:
while True:
start_chapter_id = input("您已按下Ctrl+C,请输入起始章节的id\n(输入help以查看帮助,再次按下Ctrl+C以强制关闭程序):\n")
start_chapter_id = input("您已按下Ctrl+C,请输入起始章节的id\n(输入help以查看帮助,"
"epub电子书模式不支持起始章节,再次按下Ctrl+C以强制关闭程序):\n")
if start_chapter_id == 'help':
print("\n打开小说章节阅读界面,上方链接中的数字即为章节id\n请输入您想要开始下载的章节的id\n")
continue
Expand Down Expand Up @@ -340,7 +341,7 @@ def perform_user_mode_action():
return_info = fc.fanqie_c(page_url, txt_encoding, ua, type_path_num, start_chapter_id)
elif mode == 4:
# 调用番茄epub电子书模式函数
return_info = fe.fanqie_epub(page_url, ua, type_path_num, start_chapter_id)
return_info = fe.fanqie_epub(page_url, ua, type_path_num)


# 检查更新
Expand Down

0 comments on commit 0575b6b

Please sign in to comment.