core: cardigann json: add NoResultsMessage to Search Paths Response block

some json servers in response to a query-not-found return a message string instead of a json object.
so this is a way to avoid a json-object-no-found error and get a graceful no-results-found state.
This commit is contained in:
Garfield69
2021-10-25 12:00:19 +13:00
parent a605a2935a
commit 5d00fda03e
2 changed files with 3 additions and 0 deletions

View File

@@ -1383,6 +1383,8 @@ namespace Jackett.Common.Indexers
{
if (response.Status != HttpStatusCode.OK)
throw new Exception($"Error Parsing Json Response: Status={response.Status} Response={results}");
if (response.Status == HttpStatusCode.OK && SearchPath.Response != null && SearchPath.Response.NoResultsMessage != null && SearchPath.Response.NoResultsMessage.Equals(results))
continue;
var parsedJson = JToken.Parse(results);
if (parsedJson == null)
throw new Exception("Error Parsing Json Response");

View File

@@ -201,6 +201,7 @@ namespace Jackett.Common.Models
{
public string Type { get; set; }
public string Attribute { get; set; }
public string NoResultsMessage { get; set; }
public bool Multiple { get; set; } = false;
}
}