YTS: handle error messages

This commit is contained in:
kaso17
2018-04-01 15:25:35 +02:00
parent 93d1976a14
commit c9a53fa2b2

View File

@@ -112,7 +112,11 @@ namespace Jackett.Common.Indexers
try try
{ {
var jsonContent = JObject.Parse(response.Content); // returned content might start with an html error message, remove it first
var jsonStart = response.Content.IndexOf('{');
var jsonContentStr = response.Content.Remove(0, jsonStart);
var jsonContent = JObject.Parse(jsonContentStr);
string result = jsonContent.Value<string>("status"); string result = jsonContent.Value<string>("status");
if (result != "ok") // query was not successful if (result != "ok") // query was not successful