New: (Cardigann) Add `login.test.contains`

cardigann-contains
Bogdan 11 months ago
parent 8bd6a313b7
commit d4fd7720c7

@ -28,8 +28,8 @@ namespace NzbDrone.Core.IndexerVersions
{ {
/* Update Service will fall back if version # does not exist for an indexer per Ta */ /* Update Service will fall back if version # does not exist for an indexer per Ta */
private const string DEFINITION_BRANCH = "master"; private const string DEFINITION_BRANCH = "cardigann-contains";
private const int DEFINITION_VERSION = 9; private const int DEFINITION_VERSION = 10;
// Used when moving yml to C# // Used when moving yml to C#
private readonly List<string> _definitionBlocklist = new () private readonly List<string> _definitionBlocklist = new ()

@ -134,6 +134,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
{ {
public string Path { get; set; } public string Path { get; set; }
public string Selector { get; set; } public string Selector { get; set; }
public string Contains { get; set; }
} }
public class RatioBlock : SelectorBlock public class RatioBlock : SelectorBlock

@ -1028,6 +1028,16 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
return true; return true;
} }
if (_definition.Login.Test?.Contains != null && _definition.Login.Test.Contains.IsNotNullOrWhiteSpace())
{
if (_definition.Login.Test.Contains[0] == '!')
{
return response.Content.Contains(_definition.Login.Test.Contains[1..]);
}
return !response.Content.Contains(_definition.Login.Test.Contains);
}
// Only run html test selector on html responses // Only run html test selector on html responses
if (_definition.Login.Test?.Selector != null && (response.Headers.ContentType?.Contains("text/html") ?? true)) if (_definition.Login.Test?.Selector != null && (response.Headers.ContentType?.Contains("text/html") ?? true))
{ {

Loading…
Cancel
Save