fix exception

This commit is contained in:
jxxghp
2024-04-30 10:08:06 +08:00
parent 05b8b9ae20
commit 8c60d2730b
2 changed files with 8 additions and 2 deletions

View File

@@ -641,12 +641,15 @@ class ContractCheck(_PluginBase):
html_text = res.text
if not html_text:
return None
else:
elif res is not None:
logger.error(
"站点 %s 被反爬限制:%s, 状态码:%s"
% (site_name, url, res.status_code)
)
return None
else:
logger.error(f"站点 {site_name} 无法访问:{url}")
return None
# 兼容假首页情况,假首页通常没有 <link rel="search" 属性
if '"search"' not in html_text and '"csrf-token"' not in html_text:

View File

@@ -1095,9 +1095,12 @@ class SiteStatistic(_PluginBase):
html_text = res.text
if not html_text:
return None
else:
elif res is not None:
logger.error("站点 %s 被反爬限制:%s, 状态码:%s" % (site_name, url, res.status_code))
return None
else:
logger.error("站点 %s 无法访问:%s" % (site_name, url))
return None
# 兼容假首页情况,假首页通常没有 <link rel="search" 属性
if '"search"' not in html_text and '"csrf-token"' not in html_text: