fixed bug where offset was increased too soon

This commit is contained in:
glax 2023-05-18 18:20:04 +02:00
parent e3247e6242
commit cbdc91985b

View File

@ -28,6 +28,7 @@ public class MangaDex : Connector
offset += limit; offset += limit;
DownloadClient.RequestResult requestResult = _downloadClient.MakeRequest(string.Concat(publicationsUrl, "0")); DownloadClient.RequestResult requestResult = _downloadClient.MakeRequest(string.Concat(publicationsUrl, "0"));
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result); JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result);
offset += limit;
if (result is null) if (result is null)
break; break;
@ -122,10 +123,11 @@ public class MangaDex : Connector
List<Chapter> chapters = new(); List<Chapter> chapters = new();
while (offset < total) while (offset < total)
{ {
offset += limit;
DownloadClient.RequestResult requestResult = DownloadClient.RequestResult requestResult =
_downloadClient.MakeRequest($"https://api.mangadex.org/manga/{id}/feed?limit={limit}&offset={offset}&translatedLanguage%5B%5D={language}"); _downloadClient.MakeRequest($"https://api.mangadex.org/manga/{id}/feed?limit={limit}&offset={offset}&translatedLanguage%5B%5D={language}");
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result); JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result);
offset += limit;
if (result is null) if (result is null)
break; break;