diff --git a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/Avistaz.cs b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/Avistaz.cs index 068935ff8..78efd5ce0 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/Avistaz.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/Avistaz.cs @@ -77,6 +77,12 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz return false; } + protected override void ModifyRequest(IndexerRequest request) + { + request.HttpRequest.Headers.Set("Authorization", $"Bearer {Settings.Token}"); + base.ModifyRequest(request); + } + protected override async Task TestConnection() { try diff --git a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazApi.cs b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazApi.cs index dfce16ed8..21ba62b79 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazApi.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazApi.cs @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz public int Seed { get; set; } [JsonProperty(PropertyName = "file_size")] - public int FileSize { get; set; } + public long FileSize { get; set; } [JsonProperty(PropertyName = "file_count")] public int FileCount { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazParser.cs index a49cf9daa..89798c801 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazParser.cs @@ -47,11 +47,6 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz } var jsonResponse = new HttpResponse(indexerResponse.HttpResponse); - if (jsonResponse.Resource.Status != "success" || - jsonResponse.Resource.Status.IsNullOrWhiteSpace()) - { - return torrentInfos; - } foreach (var row in jsonResponse.Resource.Data) { diff --git a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs index 4d3721a7d..11541064b 100644 --- a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs @@ -409,6 +409,19 @@ namespace NzbDrone.Core.Indexers return Task.CompletedTask; } + protected virtual void ModifyRequest(IndexerRequest request) + { + request.HttpRequest.Cookies.Clear(); + + if (Cookies != null) + { + foreach (var cookie in Cookies) + { + request.HttpRequest.Cookies.Add(cookie.Key, cookie.Value); + } + } + } + protected virtual async Task FetchIndexerResponse(IndexerRequest request) { _logger.Debug("Downloading Feed " + request.HttpRequest.ToString(false)); @@ -448,15 +461,8 @@ namespace NzbDrone.Core.Indexers _logger.Trace("Attempting to re-auth based on indexer search response"); await DoLogin(); - request.HttpRequest.Cookies.Clear(); - if (Cookies != null) - { - foreach (var cookie in Cookies) - { - request.HttpRequest.Cookies.Add(cookie.Key, cookie.Value); - } - } + ModifyRequest(request); response = await _httpClient.ExecuteAsync(request.HttpRequest); }