Repository navigation
列表页只写月日时从分组标题读出年份 - #109
Merged
Merged
Conversation
有的列表页按月分组,组标题写「七月,2026」,每行只写「10 七月」。按配置读出来的日期全是空的,第一次抓往回翻两年时就停不下来,会一直翻到最后一页。 - 按配置读的条目只有月和日时,年份取条目所在分组的标题:条目或它所在的列表前面最近的、有字没链接的短标题 - 认得出 09-10、9月10日、九月 10、10 九月;找不到年份就留空,不猜 - 加一份按云南大学信息学院通知公告的结构自编的样例
日期写错了的、整行文字里的编号和电话,以及「2025-2026学年」「2020年网站改版」这类标题,都不再被读成日期。
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联
路线图 #2「列表页的年份写在分组标题里时读出日期」,#101 试抓时发现。
改了什么
有的列表页按月分组,组标题写「七月,2026」,每行只写「10 七月」(云南大学信息学院通知公告就是这样)。按配置读出来的日期全是空的。第一次抓要往回翻两年,靠条目的日期判断停在哪,日期全空就会一直翻到最后一页,对源站不友好。
date取到的整个是月和日时(09-10、9/10、9月10日、九月 10、10 九月),年份取条目所在分组的标题:从条目往上,每一层看它前面最近的、有字没链接的元素,整个是年份、可以带月份的就用(「七月,2026」「2026年」「2026年7月」「2026-07」),不是就到上一层,到body为止。怎么验证的
./check.sh通过,351 个测试。新测试覆盖按月分组的样例(含跨年的一组),以及上面几种不该读出日期的情况。影响
只影响按配置读的列表页,原来能读出日期的照旧。接口、表结构、MCP 工具:无。