mirror of
https://github.com/Jackett/Jackett
synced 2025-03-10 14:14:25 +00:00
YTS: handle YTS bug where count>0 but no movies. Resolves #12598
This commit is contained in:
parent
bc7af6249c
commit
4095bd030d
3 changed files with 16 additions and 4 deletions
|
@ -66,6 +66,8 @@ search:
|
|||
selector: data.movies
|
||||
attribute: torrents
|
||||
multiple: true
|
||||
# bug at YTS can return movie_count > 0 and no movie torrents #12598
|
||||
missingAttributeEquals0Results: true
|
||||
count:
|
||||
selector: data.movie_count
|
||||
|
||||
|
|
|
@ -1407,6 +1407,8 @@ namespace Jackett.Common.Indexers
|
|||
}
|
||||
|
||||
var rowsArray = JsonParseRowsSelector(parsedJson, Search.Rows.Selector);
|
||||
if (rowsArray == null && Search.Rows.MissingAttributeEquals0Results)
|
||||
continue;
|
||||
if (rowsArray == null)
|
||||
throw new Exception("Error Parsing Rows Selector. There are 0 rows.");
|
||||
|
||||
|
@ -2100,10 +2102,17 @@ namespace Jackett.Common.Indexers
|
|||
private JArray JsonParseRowsSelector(JToken parsedJson, string rowSelector)
|
||||
{
|
||||
var selector = rowSelector.Split(':')[0];
|
||||
var rowsObj = parsedJson.SelectToken(selector).Value<JArray>();
|
||||
return new JArray(rowsObj.Where(t =>
|
||||
JsonParseFieldSelector(t.Value<JObject>(), rowSelector.Remove(0, selector.Length)) != null
|
||||
));
|
||||
try
|
||||
{
|
||||
var rowsObj = parsedJson.SelectToken(selector).Value<JArray>();
|
||||
return new JArray(rowsObj.Where(t =>
|
||||
JsonParseFieldSelector(t.Value<JObject>(), rowSelector.Remove(0, selector.Length)) != null
|
||||
));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private string JsonParseFieldSelector(JToken parsedJson, string rowSelector)
|
||||
|
|
|
@ -152,6 +152,7 @@ namespace Jackett.Common.Models
|
|||
public selectorBlock Dateheaders { get; set; }
|
||||
public selectorBlock Count { get; set; }
|
||||
public bool Multiple { get; set; } = false;
|
||||
public bool MissingAttributeEquals0Results { get; set; } = false;
|
||||
}
|
||||
|
||||
public class searchPathBlock : requestBlock
|
||||
|
|
Loading…
Add table
Reference in a new issue