Fixed: (IPTorrents) Fix pagination when limit is zero

pull/1319/head
Bogdan 2 years ago committed by Qstick
parent 2cebdf4a06
commit 8917347c0b

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Indexers.Definitions
{
public override string Name => "IPTorrents";
public override string[] IndexerUrls => new string[]
public override string[] IndexerUrls => new[]
{
"https://iptorrents.com/",
"https://iptorrents.me/",
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IIndexerRequestGenerator GetRequestGenerator()
{
return new IPTorrentsRequestGenerator() { Settings = Settings, Capabilities = Capabilities };
return new IPTorrentsRequestGenerator { Settings = Settings, Capabilities = Capabilities };
}
public override IParseIndexerResponse GetParser()
@ -161,10 +161,6 @@ namespace NzbDrone.Core.Indexers.Definitions
public IPTorrentsSettings Settings { get; set; }
public IndexerCapabilities Capabilities { get; set; }
public IPTorrentsRequestGenerator()
{
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories, int limit, int offset, string imdbId = null)
{
var searchUrl = Settings.BaseUrl + "t";
@ -194,9 +190,16 @@ namespace NzbDrone.Core.Indexers.Definitions
qc.Add(cat, string.Empty);
}
qc.Add("p", ((offset / limit) + 1).ToString());
if (offset > 0 && limit > 0)
{
var page = (int)(offset / limit) + 1;
qc.Add("p", page.ToString());
}
searchUrl = searchUrl + "?" + qc.GetQueryString();
if (qc.Count > 0)
{
searchUrl += $"?{qc.GetQueryString()}";
}
var request = new IndexerRequest(searchUrl, HttpAccept.Html);
@ -356,10 +359,6 @@ namespace NzbDrone.Core.Indexers.Definitions
public class IPTorrentsSettings : CookieTorrentBaseSettings
{
public IPTorrentsSettings()
{
}
[FieldDefinition(2, Label = "Cookie User-Agent", Type = FieldType.Textbox, HelpText = "User-Agent associated with cookie used from Browser")]
public string UserAgent { get; set; }

Loading…
Cancel
Save