mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: (HDBits) Treat 403 as Query Limit
This commit is contained in:
@@ -23,29 +23,29 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|||||||
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.Forbidden)
|
||||||
{
|
{
|
||||||
throw new IndexerException(indexerResponse,
|
throw new RequestLimitReachedException(indexerResponse, "HDBits Query Limit Reached. Please try again later.");
|
||||||
"Unexpected response status {0} code from API request",
|
}
|
||||||
indexerResponse.HttpResponse.StatusCode);
|
|
||||||
|
if (indexerHttpResponse.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
throw new IndexerException(indexerResponse, "Unexpected response status {0} code from API request", indexerHttpResponse.StatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
var jsonResponse = JsonConvert.DeserializeObject<HDBitsResponse>(indexerResponse.Content);
|
var jsonResponse = JsonConvert.DeserializeObject<HDBitsResponse>(indexerResponse.Content);
|
||||||
|
|
||||||
if (jsonResponse.Status != StatusCode.Success)
|
if (jsonResponse.Status != StatusCode.Success)
|
||||||
{
|
{
|
||||||
throw new IndexerException(indexerResponse,
|
throw new IndexerException(indexerResponse, "HDBits API request returned status code {0}: {1}", jsonResponse.Status, jsonResponse.Message ?? string.Empty);
|
||||||
"HDBits API request returned status code {0}: {1}",
|
|
||||||
jsonResponse.Status,
|
|
||||||
jsonResponse.Message ?? string.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var responseData = jsonResponse.Data as JArray;
|
var responseData = jsonResponse.Data as JArray;
|
||||||
if (responseData == null)
|
if (responseData == null)
|
||||||
{
|
{
|
||||||
throw new IndexerException(indexerResponse,
|
throw new IndexerException(indexerResponse, "Indexer API call response missing result data");
|
||||||
"Indexer API call response missing result data");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var queryResults = responseData.ToObject<TorrentQueryResponse[]>();
|
var queryResults = responseData.ToObject<TorrentQueryResponse[]>();
|
||||||
|
Reference in New Issue
Block a user