8000 Fix anime/manga news pages (#661) and recently-updated progress cells (#663) by irfan-dahir · Pull Request #668 · jikan-me/jikan · GitHub
[go: up one dir, main page]

Skip to content

Fix anime/manga news pages (#661) and recently-updated progress cells (#663) - #668

Merged
irfan-dahir merged 2 commits into
masterfrom
v5/recently-updated-dash-progress
Oct 15, 2026
Merged

irfan-dahir merged 2 commits into
masterfrom
v5/recently-updated-dash-progress

Conversation

@irfan-dahir
Copy link
Copy Markdown
Collaborator

Needs jikan-me/jikan-fixtures#19 merged first: six recorded pages and their snapshots (CI clones fixtures master).

Fixes #661. Fixes #663. Both were reported from testing jikan-rest #614 on v5.0.0-beta.2. I reproduced each on pages recorded live today before changing anything.

#661: getNewsList() returns nothing for an anime's or manga's news

A regression from v4: those pages parsed in v4. When #630 realigned the parser to the main news index (div.news-unit), the per-title pages (/anime/{id}/_/news) lost their parser, and nothing in the corpus covered them.

  • New TitleNewsListItemParser (extends the index item parser, so the same ResourceNewsListItem comes out). ResourceNewsListParser falls back to it when a page has no div.news-unit; the index is untouched.
  • Verified on 4 recorded pages: 9, 30, 30 and 25 articles, each with absolute /news/{id}, author and discussion links, UTC date, comment count, excerpt without the "read more" link, and the real image (the page lazy-loads it).
  • Pagination. lastVisiblePage was always 1; hasNextPage() treated any link beyond page 1 as a next page, but on page 2 the "News" tab links to ?p=2, the page itself. Both now use links beyond the current page. The index's lastVisiblePage is now 20, not 1.

#663: a bare - in a progress cell

  • Reproduced live. Manga 2: 39 of 75 rows have a bare - in the volumes column. Anime 21: 4 rows (the issue said it wasn't reproduced for anime). With warnings as exceptions, getResults() returned 0 rows, because of its catch-all.
  • Parser::parseProgress() reads every shape (5/12, 5/?, -/12, -, empty) and all six getters use it.
  • Found while checking: 5/? (a series that's still running) gave a total of 0. 71 of One Piece's 75 rows. It's null now. If you treated 0 as unknown, check for null.
  • No more catch-all. A page without the table has no rows; a row that can't be parsed throws and MalClient reports a ParserException, instead of an empty page next to a hasNextPage() that could be true. This is the one judgment call here: the alternative is skipping the bad row, but that hides markup changes, so I chose to fail loudly.

Tests

TitleNewsTest (12) and RecentlyUpdatedProgressTest (13) run on the recorded pages. Run against the old code, 8 of 12 and 3 of 13 fail; the rest cover things that were already right. Six new corpus variants have snapshots, and the invariants allowlist and PHPStan baseline each shrank. 1,047 tests pass locally.

Changelog entries are under Fixed.

🤖 Generated with Claude Code

irfan-dahir and others added 2 commits October 16, 2026 00:21
…#663)

#661: getNewsList() returned no articles for an anime's or manga's news page. Those
pages have their own layout (no div.news-unit); a TitleNewsListItemParser reads it
into the same ResourceNewsListItem, with absolute links. lastVisiblePage was always
1, and hasNextPage() counted the "News" tab (a link to the current page): both now
follow the links beyond the current page.

#663: the progress cell of "recently updated by users" is often a bare "-" (39 of 75
manga rows on manga 2), which made the total getters read a missing array key, and
the catch-all in getResults() then returned no rows at all where warnings become
exceptions. One Parser::parseProgress() reads every shape; "5/?" is now a null
total instead of 0; an unparseable row is an error, not an empty page.

Tests use six pages recorded live; each new test fails on the old code.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… news parser

The PR's mutation run (85%, floor 88%) flagged untested new code: a comment count that
is singular, capitalised or absent, and the current page when the URL has no ?p= or
?p=0. Also a progress cell with more than two parts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@irfan-dahir
irfan-dahir merged commit 89c0851 into master Oct 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant

0