mirror of
https://github.com/Jackett/Jackett
synced 2025-02-25 23:52:53 +00:00
Pagination on NxtGn
I've added support for offset and limit parameters on the NextGen tracker
This commit is contained in:
parent
c07fc4de44
commit
09d00eba32
2 changed files with 89 additions and 97 deletions
|
@ -136,16 +136,13 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||||
{
|
{
|
||||||
|
var releasesPerPage = 100;
|
||||||
var releases = new List<ReleaseInfo>();
|
var releases = new List<ReleaseInfo>();
|
||||||
var breakWhile = false;
|
var page = (query.Offset / releasesPerPage) + 1;
|
||||||
var page = 0;
|
|
||||||
while (page < 3)
|
|
||||||
{
|
|
||||||
string episodeSearchUrl;
|
string episodeSearchUrl;
|
||||||
if (string.IsNullOrEmpty(query.GetQueryString()))
|
if (string.IsNullOrEmpty(query.GetQueryString()))
|
||||||
{
|
{
|
||||||
episodeSearchUrl = SearchUrl + "?page=" + page;
|
episodeSearchUrl = SearchUrl + "?page=" + page;
|
||||||
breakWhile = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -153,7 +150,6 @@ namespace Jackett.Indexers
|
||||||
var catsUrlPart = string.Join("&", cats.Select(c => $"c{c}=1"));
|
var catsUrlPart = string.Join("&", cats.Select(c => $"c{c}=1"));
|
||||||
episodeSearchUrl = string.Format("{0}?search={1}&cat=0&incldead=0&{2}&page={3}", SearchUrl, HttpUtility.UrlEncode(query.GetQueryString()), catsUrlPart, page);
|
episodeSearchUrl = string.Format("{0}?search={1}&cat=0&incldead=0&{2}&page={3}", SearchUrl, HttpUtility.UrlEncode(query.GetQueryString()), catsUrlPart, page);
|
||||||
}
|
}
|
||||||
page++;
|
|
||||||
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
|
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -229,17 +225,11 @@ namespace Jackett.Indexers
|
||||||
release.TVDBId = long.Parse(url.Substring(url.LastIndexOf('=') + 1));
|
release.TVDBId = long.Parse(url.Substring(url.LastIndexOf('=') + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var nextPage = dom["#torrent-table-wrapper + p[align=center]"].Children().Last();
|
|
||||||
if (!nextPage.Is("a"))
|
|
||||||
breakWhile = true;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
OnParseError(results.Content, ex);
|
OnParseError(results.Content, ex);
|
||||||
}
|
}
|
||||||
if (breakWhile)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return releases;
|
return releases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,9 @@
|
||||||
<Content Include="Content\logos\broadcastthenet.png">
|
<Content Include="Content\logos\broadcastthenet.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\logos\danishbits.PNG" />
|
<Content Include="Content\logos\danishbits.PNG">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="Content\logos\demonoid.png">
|
<Content Include="Content\logos\demonoid.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in a new issue