From 96ab26c4293c9f9e2d9b7c077dc9a991f761bc00 Mon Sep 17 00:00:00 2001 From: oscarz Date: Tue, 18 Mar 2025 18:01:49 +0800 Subject: [PATCH] modify scripts --- aabook/src/scraper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aabook/src/scraper.py b/aabook/src/scraper.py index 1c4362a..b0928f5 100644 --- a/aabook/src/scraper.py +++ b/aabook/src/scraper.py @@ -189,7 +189,7 @@ def pase_chapter_list(soup, url): chap_data = [] for chap in chap_list: chap_title = chap.get_text().strip() - chap_link = f'{host_url}/{chap['href']}' + chap_link = f"{host_url}/{chap['href']}" chap_id = utils.extract_page_num(chap_link) chap_data.append({'href': chap_link, 'title': chap_title, 'chapter_id': chap_id}) table_of_contents.append({'title': section_title, 'chapters': chap_data}) @@ -250,7 +250,7 @@ def parse_chapter_page(soup, url): if next_div: next_page_tag = next_div.find('a', href=True, title=re.compile(r'下一章')) if next_page_tag: - next_url = f'{host_url}/{next_page_tag['href']}' if next_page_tag['href'] else '' + next_url = f"{host_url}/{next_page_tag['href']}" if next_page_tag['href'] else '' data = {'title': title, 'content_url': content_url, 'table_of_contents': table_of_contents} return data, next_url