2
0

Fixed MangaDex GetMangaFromUrl Regex-Group and resultobject

This commit is contained in:
glax 2023-09-02 22:12:34 +02:00
parent 6e3a9c2a78
commit 99ad702163

View File

@ -74,7 +74,7 @@ public class MangaDex : MangaConnector
public override Manga? GetMangaFromUrl(string url) public override Manga? GetMangaFromUrl(string url)
{ {
Regex idRex = new (@"https:\/\/mangadex.org\/title\/([A-z0-9-]*)\/.*"); Regex idRex = new (@"https:\/\/mangadex.org\/title\/([A-z0-9-]*)\/.*");
string id = idRex.Match(url).Value; string id = idRex.Match(url).Groups[1].Value;
Log($"Got id {id} from {url}"); Log($"Got id {id} from {url}");
DownloadClient.RequestResult requestResult = DownloadClient.RequestResult requestResult =
downloadClient.MakeRequest($"https://api.mangadex.org/manga/{id}", (byte)RequestType.Manga); downloadClient.MakeRequest($"https://api.mangadex.org/manga/{id}", (byte)RequestType.Manga);
@ -82,7 +82,7 @@ public class MangaDex : MangaConnector
return null; return null;
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result); JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result);
if(result is not null) if(result is not null)
return MangaFromJsonObject(result); return MangaFromJsonObject(result["data"]!.AsObject());
return null; return null;
} }