fix(site): recognize Gazelle login state (#6464)

This commit is contained in:
jxxghp
2026-08-26 21:09:19 +08:00
parent 88703d645a
commit 0a5b6a637d
2 changed files with 45 additions and 0 deletions
+21
View File
@@ -12,8 +12,29 @@ from app.modules.indexer.parser import SiteParserBase, SiteSchema
class GazelleSiteUserInfo(SiteParserBase):
"""Gazelle 站点用户数据解析器。"""
schema = SiteSchema.Gazelle
def _parse_logged_in(self, html_text: str) -> bool:
"""
识别 Gazelle 登录态,兼容不展示退出入口的站点首页。
:param html_text: 站点首页 HTML
:return: 已登录返回 True,否则返回 False
"""
html = etree.HTML(html_text)
try:
if DomUtils.has_child_elements(html) and html.xpath(
'//a[contains(@href, "user.php?id=")]'
):
return True
finally:
if html is not None:
del html
return super()._parse_logged_in(html_text)
def _parse_user_base_info(self, html_text: str):
html_text = self._prepare_html_text(html_text)
html = etree.HTML(html_text)