mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-06 05:33:57 +08:00
fix: parse Audiences unread messages
This commit is contained in:
@@ -44,3 +44,89 @@ def test_audiences_userbar_metrics_override_generic_nexus_regex():
|
||||
assert parser.bonus == 1973896.2
|
||||
assert parser.seeding == 355
|
||||
assert parser.leeching == 7
|
||||
|
||||
|
||||
def test_audiences_inbox_total_unread_badge_uses_unread_part():
|
||||
parser = NexusAudiencesSiteUserInfo(
|
||||
site_name="Audiences",
|
||||
url="https://audiences.me/",
|
||||
site_cookie="",
|
||||
apikey=None,
|
||||
token=None,
|
||||
)
|
||||
html_text = """
|
||||
<html>
|
||||
<body>
|
||||
<div class="site-userbar__compact-actions">
|
||||
<a class="site-userbar__compact-tool site-userbar__compact-tool--has-unread"
|
||||
href="messages.php"
|
||||
title="收件箱 1749/172"
|
||||
aria-label="收件箱 1749/172">
|
||||
<i class="fas fa-inbox" aria-hidden="true"></i>
|
||||
<strong>收件箱</strong>
|
||||
<span class="site-userbar__compact-tool-badge site-userbar__compact-tool-badge--unread">1749/172</span>
|
||||
</a>
|
||||
<a class="site-userbar__compact-tool"
|
||||
href="messages.php?action=viewmailbox&box=-1"
|
||||
title="发件箱 0"
|
||||
aria-label="发件箱 0">
|
||||
<strong>发件箱</strong>
|
||||
<span class="site-userbar__compact-tool-badge">0</span>
|
||||
</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
parser._parse_message_unread(html_text)
|
||||
|
||||
assert parser.message_unread == 172
|
||||
|
||||
|
||||
def test_audiences_table_unread_links_ignore_content_rows():
|
||||
parser = NexusAudiencesSiteUserInfo(
|
||||
site_name="Audiences",
|
||||
url="https://audiences.me/",
|
||||
site_cookie="",
|
||||
apikey=None,
|
||||
token=None,
|
||||
)
|
||||
html_text = """
|
||||
<html>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="rowfollow" align="center">
|
||||
<img class="unreadpm" src="pic/trans.gif" alt="Unread" title="未读">
|
||||
</td>
|
||||
<td class="rowfollow" align="left">
|
||||
<a href="messages.php?action=viewmessage&id=4318225">种子被删除</a>
|
||||
</td>
|
||||
<td class="rowfollow" align="left">系统</td>
|
||||
<td class="rowfollow" nowrap=""><span title="2026-05-07 23:01:58">8天17时前</span></td>
|
||||
<td class="rowfollow"><input class="checkbox" type="checkbox" name="messages[]" value="4318225"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" style="padding: 8px;">消息摘要内容</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="rowfollow" align="center">
|
||||
<img class="readpm" src="pic/trans.gif" alt="Read" title="已读">
|
||||
</td>
|
||||
<td class="rowfollow" align="left">
|
||||
<a href="messages.php?action=viewmessage&id=4318000">已读消息</a>
|
||||
</td>
|
||||
<td class="rowfollow" align="left">系统</td>
|
||||
<td class="rowfollow" nowrap=""><span title="2026-05-07 23:01:58">8天17时前</span></td>
|
||||
<td class="rowfollow"><input class="checkbox" type="checkbox" name="messages[]" value="4318000"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
msg_links = []
|
||||
|
||||
next_page = parser._parse_message_unread_links(html_text, msg_links)
|
||||
|
||||
assert msg_links == ["messages.php?action=viewmessage&id=4318225"]
|
||||
assert next_page is None
|
||||
|
||||
Reference in New Issue
Block a user