请确认注意事项
发生Bug时,你的使用方式?
Python代码
你是否在禁漫官方网页或APP,验证过相应的功能是正常的?
测试过,禁漫官方功能正常
代码/option配置
问题位于 jm_toolkit.py
pattern_html_favorite_total = compile(r' : (\d+)[^/]/\D(\d+)')
最小复现(JmHtmlClient 已登录)
import re
resp = client.get_jm_html(
f'/user/{username}/favorite/albums',
params={'page': 1, 'o': 'mr', 'folder': '0'},
)
text = resp.text
print(re.search(r' : (\d+)[^/]/\D(\d+)', text).groups())
实际输出: ('50', '35')
print(re.search(r'總數 : (\d+)\s*/\s*\d+', text).group(1))
期望的总数: 6
描述bug现象(你预期的结果,与实际结果的差别)
预期:JmHtmlClient.favorite_folder().total 应等于收藏夹页显示的 總數 : 6 / 600 中的 6(当前视图实际本子数)。
实际:total 恒为 50。
原因定位:收藏夹页改版后,<style> 中出现 width : 50px; 等 CSS;正则 : (\d+)[^/]/\D(\d+) 用 re.search 全文搜索时先命中这段 CSS(groups=('50','35')),而真正的 總數 : 6\n / 600(groups=('6','600'))在文档更靠后的位置
影响:所有收藏夹的 total 恒为 50。
其他可提供的信息
版本:jmcomic 2.7.1;Python 3.13(Windows 11)
该问题出现在站点收藏夹页改版之后(旧页面无 width : 50px 这类可命中文本)
内容解析(favorites_album_ 条目)正常,仅 total 受影响
页面原文关键片段(可附):
误命中处:width : 50px;\n height: 50px;\n}\n.modal-content{...
真实计数处:總數 : 6\n / 600
请确认注意事项
发生Bug时,你的使用方式?
Python代码
你是否在禁漫官方网页或APP,验证过相应的功能是正常的?
测试过,禁漫官方功能正常
代码/option配置
问题位于 jm_toolkit.py
pattern_html_favorite_total = compile(r' : (\d+)[^/]/\D(\d+)')
最小复现(JmHtmlClient 已登录)
import re
resp = client.get_jm_html(
f'/user/{username}/favorite/albums',
params={'page': 1, 'o': 'mr', 'folder': '0'},
)
text = resp.text
print(re.search(r' : (\d+)[^/]/\D(\d+)', text).groups())
实际输出: ('50', '35')
print(re.search(r'總數 : (\d+)\s*/\s*\d+', text).group(1))
期望的总数: 6
描述bug现象(你预期的结果,与实际结果的差别)
预期:JmHtmlClient.favorite_folder().total 应等于收藏夹页显示的 總數 : 6 / 600 中的 6(当前视图实际本子数)。
实际:total 恒为 50。
原因定位:收藏夹页改版后,<style> 中出现 width : 50px; 等 CSS;正则 : (\d+)[^/]/\D(\d+) 用 re.search 全文搜索时先命中这段 CSS(groups=('50','35')),而真正的 總數 : 6\n / 600(groups=('6','600'))在文档更靠后的位置
影响:所有收藏夹的 total 恒为 50。
其他可提供的信息
版本:jmcomic 2.7.1;Python 3.13(Windows 11)
该问题出现在站点收藏夹页改版之后(旧页面无 width : 50px 这类可命中文本)
内容解析(favorites_album_ 条目)正常,仅 total 受影响
页面原文关键片段(可附):
误命中处:width : 50px;\n height: 50px;\n}\n.modal-content{...
真实计数处:總數 : 6\n / 600