Shorten RequestUrl for MangaDex MangaInfo

Lower MaxRequestLimits
This commit is contained in:
Glax 2025-05-08 04:39:22 +02:00
parent 57baad3d2c
commit 30a8162777
2 changed files with 6 additions and 7 deletions

View File

@ -24,16 +24,15 @@ public class MangaDex : MangaConnector
HashSet<(Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)> retManga = new(); HashSet<(Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)> retManga = new();
List<JsonNode> results = new(); List<JsonNode> results = new();
publicationTitle = publicationTitle.Replace(" ", "%20");
//Request all search-results //Request all search-results
while (offset < total) //As long as we haven't requested all "Pages" while (offset < total) //As long as we haven't requested all "Pages"
{ {
//Request next Page //Request next Page
string requestUrl = string requestUrl =
$"https://api.mangadex.org/manga?limit={limit}&title={publicationTitle}&offset={offset}" + $"https://api.mangadex.org/manga?limit={limit}&title={publicationTitle}&offset={offset}" +
$"&contentRating%5B%5D=safe&contentRating%5B%5D=suggestive&contentRating%5B%5D=erotica" + $"&includes[]=manga&includes[]=cover_art&includes[]=author&includes[]=artist&includes[]=tag";
$"&contentRating%5B%5D=pornographic" +
$"&includes%5B%5D=manga&includes%5B%5D=cover_art&includes%5B%5D=author" +
$"&includes%5B%5D=artist&includes%5B%5D=tag";
RequestResult requestResult = downloadClient.MakeRequest(requestUrl, RequestType.MangaInfo); RequestResult requestResult = downloadClient.MakeRequest(requestUrl, RequestType.MangaInfo);
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300) if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
{ {

View File

@ -39,11 +39,11 @@ public static class TrangaSettings
[JsonIgnore] [JsonIgnore]
internal static readonly Dictionary<RequestType, int> DefaultRequestLimits = new () internal static readonly Dictionary<RequestType, int> DefaultRequestLimits = new ()
{ {
{RequestType.MangaInfo, 250}, {RequestType.MangaInfo, 60},
{RequestType.MangaDexFeed, 250}, {RequestType.MangaDexFeed, 60},
{RequestType.MangaDexImage, 40}, {RequestType.MangaDexImage, 40},
{RequestType.MangaImage, 60}, {RequestType.MangaImage, 60},
{RequestType.MangaCover, 250}, {RequestType.MangaCover, 60},
{RequestType.Default, 60} {RequestType.Default, 60}
}; };
public static Dictionary<RequestType, int> requestLimits { get; private set; } = DefaultRequestLimits; public static Dictionary<RequestType, int> requestLimits { get; private set; } = DefaultRequestLimits;