fixed bug where offset wasnt increasing
This commit is contained in:
parent
cbdc91985b
commit
340a2b7e43
@ -19,14 +19,12 @@ public class MangaDex : Connector
|
|||||||
public override Publication[] GetPublications(string publicationTitle = "")
|
public override Publication[] GetPublications(string publicationTitle = "")
|
||||||
{
|
{
|
||||||
const int limit = 100;
|
const int limit = 100;
|
||||||
string publicationsUrl = $"https://api.mangadex.org/manga?limit={limit}&title={publicationTitle}&offset=";
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int total = int.MaxValue;
|
int total = int.MaxValue;
|
||||||
HashSet<Publication> publications = new();
|
HashSet<Publication> publications = new();
|
||||||
while (offset < total)
|
while (offset < total)
|
||||||
{
|
{
|
||||||
offset += limit;
|
DownloadClient.RequestResult requestResult = _downloadClient.MakeRequest($"https://api.mangadex.org/manga?limit={limit}&title={publicationTitle}&offset={offset}");
|
||||||
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;
|
offset += limit;
|
||||||
if (result is null)
|
if (result is null)
|
||||||
|
Loading…
Reference in New Issue
Block a user