Skip to content

Commit

Permalink
Inkroom main (#29)
Browse files Browse the repository at this point in the history
* fix: Update linovel_mobile volume title

---------

Co-authored-by: inkroom <[email protected]>
  • Loading branch information
wdpm and inkroom authored Jan 19, 2024
1 parent d5885af commit 14743a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/linovelib2epub/spider/linovelib_mobile_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ def _sanitize_html(html: BeautifulSoup) -> str:
else:
raise Exception(f'[ERROR]: request {page_link} failed.')

new_title = soup.find(id='atitle')
# 分页判断的过滤
if not new_title.text.startswith(light_novel_chapter.title):
# 样例:
# 目录中:第二章 可爱如花的N孩
# 文章页:第二章 可爱如花的女孩,第二章 可爱如花的女孩(2/3),......
# 目录页部分文字会被隐藏,所以用文章中的标题代替 new_title。文章页标题可能带有分页信息,所以不能==
self.logger.info(f'chapter : [{light_novel_chapter.title}] New Title= [{new_title.text}]')
light_novel_chapter.title = new_title.text

images = soup.find_all('img')
article_soup = soup.find(id=self._html_content_id)
article = _sanitize_html(article_soup)
Expand Down Expand Up @@ -294,7 +304,7 @@ def _get_volume_choices(catalog_list: List[CatalogLinovelibMobileVolume]):
# step 2: then reduce the whole catalog_list to a reduced_catalog_list based on user selection
# UI show
question_name = 'Selecting volumes'
question_description = "Which volumes you want to download?(select one or multiple volumes)"
question_description = "Which volumes you want to download?(use SPACE to select one or multiple volumes)"
volume_choices = _get_volume_choices(catalog_list)
questions = [
inquirer.Checkbox(question_name,
Expand Down
2 changes: 1 addition & 1 deletion src/linovelib2epub/spider/wenku8_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _get_volume_choices(catalog_list: List[CatalogBaseVolume]):
# step 2: then reduce the whole catalog_list to a reduced_catalog_list based on user selection
# UI show
question_name = 'Selecting volumes'
question_description = "Which volumes you want to download?(select one or multiple volumes)"
question_description = "Which volumes you want to download?(use SPACE to select one or multiple volumes)"
volume_choices = _get_volume_choices(catalog_list)
questions = [
inquirer.Checkbox(question_name,
Expand Down

0 comments on commit 14743a5

Please sign in to comment.