manga.lastChapter is returning different value from manga.getFeed()
Closed this issue · 5 comments
Hi all, I noticed the value for manga.lastChapter
is different from manga.getFeed()
const manga = await MFA.Manga.get('32d76d19-8a05-4db0-9fc2-e0b0648fe9d0');
manga.lastChapter // 108
const feeds = await manga.getFeed({
limit: Infinity,
translatedLanguage: ["en"],
"order[chapter]": "desc",
});
feeds[0].chapter // 144
Not sure this is a bug, or I understand the feed chapter id wrongly
.lastChapter
returns a string because it's not a function, it only gives you the lastChapter
field returned by the response.
getFeed()
is a function that returns chapter data from the /manga/id/feed
.
https://api.mangadex.org/docs.html#operation/get-manga-id
mangadex-full-api/src/structure/manga.js
Line 85 in 934d7e0
mangadex-full-api/src/structure/manga.js
Line 393 in 934d7e0
lastChapter
and lastVolume
are both returned as attributes of manga objects returned by Mangadex, so they are included as a part of the Manga class. Their values seem to be dependent on the default feed order because the first chapter based on default order seems to be the same as the Manga attribute.
However, this seems incorrect as @johnlim5847 described (this chapter is ahead by 40+ chapters). Therefore, this may be a bug on Mangadex's end or I am misunderstanding it, so for now only use lastChapter
/lastVolume
as representations of the chapter number and volume number of the first chapter in the default feed. For any other context, using a feed request with a limit of one to get the most recent/highest-number chapter in a certain language seems like the best option.
On another note, during previous versions of the official MD API, lastChapter
contained non-number titles, but while researching this issue, it seems that all occurrences of this attribute have become numbers like lastVolume
, so the type of Manga.lastChapter
may become a number like Chapter.chapter
in the next version.
@md-y is there a way to get the feed without getting the rate limit? and is it possible to open up the discussion feature for this repo 😁
I enabled the discussion feature (TBH I didn't know it existed).
As for bypassing the rate limit when requesting feeds, assuming you want to get the feeds of multiple different manga, I would create a custom list with the manga you wish to query and get the feed of that custom list. If you still simply wish to get the most recent chapter, however, I coincidentally found a new solution when implementing getAggregate
—the function includes a list of volumes and chapter numbers that can be parsed to find the most recent chapter for different languages.
@md-y thank you! I will wait for the getAggregate
function :), personally find it very inefficient to pull the feeds just to get the latest chapter