from bs4 import BeautifulSoup
root_url = "http://www.89wx.cc/17/17277/"
r = requests.get(root_url)
soup = BeautifulSoup(r.text, 'html.parser')
for dd in soup.find_all("dd"):
links.append(('http://www.89wx.cc' + link["href"], link.get_text()))
def get_chapter_content(url):
soup = BeautifulSoup(r.text, "html.parser")
text = soup.find("div", id="content").get_text()
novel_chapters = get_chapters()
for chapter in novel_chapters:
with open(title + ".txt", "w", encoding="utf-8") as f:
f.write(get_chapter_content(url))