fix(audiences): correctly filter unread messages by icon class and attributes

This commit is contained in:
jxxghp
2026-05-17 21:52:13 +08:00
parent c857ae3e14
commit 6685bd0e0e
2 changed files with 75 additions and 0 deletions

View File

@@ -42,6 +42,30 @@ class NexusAudiencesSiteUserInfo(NexusPhpSiteUserInfo):
if html is not None:
del html
def _parse_message_unread_links(self, html_text: str, msg_links: list):
"""
解析 Audiences 未读消息链接。
"""
html = etree.HTML(html_text)
try:
if not StringUtils.is_valid_html_element(html):
return None
message_links = html.xpath(
'//tr[.//img[contains(concat(" ", normalize-space(@class), " "), " unreadpm ") '
'or @alt="Unread" or @title="未读"]]/td/a[contains(@href, "viewmessage")]/@href'
)
msg_links.extend(message_links)
next_page = None
next_page_text = html.xpath('//a[contains(.//text(), "下一页") or contains(.//text(), "下一頁")]/@href')
if next_page_text:
next_page = next_page_text[-1].strip()
finally:
if html is not None:
del html
return next_page
def _parse_user_traffic_info(self, html_text):
"""
解析用户流量信息