fix(lxml): Adjust HTML element checks to prevent FutureWarning

This commit is contained in:
InfinityPacer
2024-08-31 02:14:52 +08:00
parent 9ab852c1ad
commit 93801e857e
13 changed files with 35 additions and 23 deletions
+1 -1
View File
@@ -205,7 +205,7 @@ class SiteChain(ChainBase):
logger.error(f"获取站点页面失败:{url}")
return favicon_url, None
html = etree.HTML(html_text)
if html:
if StringUtils.is_valid_html_element(html):
fav_link = html.xpath('//head/link[contains(@rel, "icon")]/@href')
if fav_link:
favicon_url = urljoin(url, fav_link[0])