mirror of https://github.com/Jackett/Jackett
rarbg: add non json response detection. resolves #13350
This commit is contained in:
parent
84f3811ce7
commit
86d7a55329
|
@ -141,6 +141,12 @@ namespace Jackett.Common.Indexers
|
||||||
await RenewalTokenAsync();
|
await RenewalTokenAsync();
|
||||||
|
|
||||||
var response = await RequestWithCookiesAndRetryAsync(BuildSearchUrl(query));
|
var response = await RequestWithCookiesAndRetryAsync(BuildSearchUrl(query));
|
||||||
|
if (response != null && response.ContentString.StartsWith("<"))
|
||||||
|
{
|
||||||
|
// the response was not JSON, likely a HTML page for a server outage
|
||||||
|
logger.Warn(response.ContentString);
|
||||||
|
throw new Exception("The response was not JSON");
|
||||||
|
}
|
||||||
var jsonContent = JObject.Parse(response.ContentString);
|
var jsonContent = JObject.Parse(response.ContentString);
|
||||||
var errorCode = jsonContent.Value<int>("error_code");
|
var errorCode = jsonContent.Value<int>("error_code");
|
||||||
switch (errorCode)
|
switch (errorCode)
|
||||||
|
|
Loading…
Reference in New Issue