diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs index 7086788b0..46273b077 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs @@ -25,26 +25,32 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn public IList ParseResponse(IndexerResponse indexerResponse) { var torrentInfos = new List(); + var indexerHttpResponse = indexerResponse.HttpResponse; - if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK) + if (indexerHttpResponse.StatusCode != HttpStatusCode.OK) { // Remove cookie cache - if (indexerResponse.HttpResponse.HasHttpRedirect && indexerResponse.HttpResponse.RedirectUrl + if (indexerHttpResponse.HasHttpRedirect && indexerHttpResponse.RedirectUrl .ContainsIgnoreCase("login.php")) { CookiesUpdater(null, null); - throw new IndexerException(indexerResponse, "We are being redirected to the PTP login page. Most likely your session expired or was killed. Try testing the indexer in the settings."); + throw new IndexerAuthException("We are being redirected to the PTP login page. Most likely your session expired or was killed. Try testing the indexer in the settings."); + } + + if (indexerHttpResponse.StatusCode == HttpStatusCode.Forbidden) + { + throw new RequestLimitReachedException(indexerResponse, "PTP Query Limit Reached. Please try again later."); } throw new IndexerException(indexerResponse, $"Unexpected response status {indexerResponse.HttpResponse.StatusCode} code from API request"); } - if (indexerResponse.HttpResponse.Headers.ContentType != HttpAccept.Json.Value) + if (indexerHttpResponse.Headers.ContentType != HttpAccept.Json.Value) { - if (indexerResponse.HttpResponse.Request.Url.Path.ContainsIgnoreCase("login.php")) + if (indexerHttpResponse.Request.Url.Path.ContainsIgnoreCase("login.php")) { CookiesUpdater(null, null); - throw new IndexerException(indexerResponse, "We are currently on the login page. Most likely your session expired or was killed. Try testing the indexer in the settings."); + throw new IndexerAuthException("We are currently on the login page. Most likely your session expired or was killed. Try testing the indexer in the settings."); } // Remove cookie cache