mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: (PTP) Treat 403 as Query Limit
This commit is contained in:
@@ -25,26 +25,32 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||||
{
|
{
|
||||||
var torrentInfos = new List<ReleaseInfo>();
|
var torrentInfos = new List<ReleaseInfo>();
|
||||||
|
var indexerHttpResponse = indexerResponse.HttpResponse;
|
||||||
|
|
||||||
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
|
if (indexerHttpResponse.StatusCode != HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
// Remove cookie cache
|
// Remove cookie cache
|
||||||
if (indexerResponse.HttpResponse.HasHttpRedirect && indexerResponse.HttpResponse.RedirectUrl
|
if (indexerHttpResponse.HasHttpRedirect && indexerHttpResponse.RedirectUrl
|
||||||
.ContainsIgnoreCase("login.php"))
|
.ContainsIgnoreCase("login.php"))
|
||||||
{
|
{
|
||||||
CookiesUpdater(null, null);
|
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");
|
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);
|
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
|
// Remove cookie cache
|
||||||
|
Reference in New Issue
Block a user