Skip to content

Commit

Permalink
specify html encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrtye committed Oct 6, 2024
1 parent fc4dbf5 commit e1347ae
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions novel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def get_url_html(url, proxy=None):

def extract_book_title(html):
try:
html.encoding = "gbk"
tree = etree.HTML(html, parser=None)
div_element = tree.xpath('//div[contains(@class, "qustime")]')[0]
span_element = div_element.xpath("./ul/li[1]/a/span")[0]
Expand Down

0 comments on commit e1347ae

Please sign in to comment.