modify
This commit is contained in:
@ -41,7 +41,20 @@ def extract_book_num(page_str, default_num = 0):
|
||||
return number
|
||||
else:
|
||||
return default_num
|
||||
|
||||
# 目录页,获取更新时间和字数
|
||||
def extract_chapter_uptime_words(input_str):
|
||||
# 定义正则表达式模式
|
||||
words_pattern = r'字数:(\d+)'
|
||||
words_match = re.search(words_pattern, input_str)
|
||||
words = words_match.group(1) if words_match else 0
|
||||
|
||||
update_time_pattern = r'更新时间:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})'
|
||||
update_time_match = re.search(update_time_pattern, input_str)
|
||||
update_time = update_time_match.group(1) if update_time_match else datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
return words, update_time
|
||||
|
||||
# 处理 [都市] 的方括号
|
||||
def remove_brackets_regex(input_str):
|
||||
pattern = r'\[(.*?)\]'
|
||||
|
||||
Reference in New Issue
Block a user