mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
@@ -277,25 +277,25 @@ namespace Jackett.Common.Indexers
|
|||||||
var numVal = 0;
|
var numVal = 0;
|
||||||
|
|
||||||
// find number of torrents / page
|
// find number of torrents / page
|
||||||
var torrent_per_page = dom.QuerySelector(".box_torrent_all").QuerySelectorAll(".box_torrent").Length;
|
var torrentPerPage = dom.QuerySelector(".box_torrent_all")?.QuerySelectorAll(".box_torrent").Length ?? 0;
|
||||||
if (torrent_per_page == 0)
|
if (torrentPerPage == 0)
|
||||||
return releases;
|
return releases;
|
||||||
var start_page = (query.Offset / torrent_per_page) + 1;
|
var startPage = (query.Offset / torrentPerPage) + 1;
|
||||||
var previously_parsed_on_page = query.Offset - (start_page * torrent_per_page) + 1; //+1 because indexing start from 0
|
var previouslyParsedOnPage = query.Offset - (startPage * torrentPerPage) + 1; //+1 because indexing start from 0
|
||||||
if (previously_parsed_on_page < 0)
|
if (previouslyParsedOnPage < 0)
|
||||||
previously_parsed_on_page = query.Offset;
|
previouslyParsedOnPage = query.Offset;
|
||||||
|
|
||||||
// find pagelinks in the bottom
|
// find pagelinks in the bottom
|
||||||
var pagelinks = dom.QuerySelector("div[id=pager_bottom]").QuerySelectorAll("a");
|
var pageLinks = dom.QuerySelector("div[id=pager_bottom]")?.QuerySelectorAll("a");
|
||||||
if (pagelinks.Length > 0)
|
if (pageLinks?.Length > 0)
|
||||||
{
|
{
|
||||||
// If there are several pages find the link for the latest one
|
// If there are several pages find the link for the latest one
|
||||||
for (var i = pagelinks.Length - 1; i > 0; i--)
|
for (var i = pageLinks.Length - 1; i > 0; i--)
|
||||||
{
|
{
|
||||||
var last_page_link = (pagelinks[i].GetAttribute("href")).Trim();
|
var lastPageLink = (pageLinks[i].GetAttribute("href")).Trim();
|
||||||
if (last_page_link.Contains("oldal"))
|
if (lastPageLink.Contains("oldal"))
|
||||||
{
|
{
|
||||||
var match = Regex.Match(last_page_link, @"(?<=[\?,&]oldal=)(\d+)(?=&)");
|
var match = Regex.Match(lastPageLink, @"(?<=[\?,&]oldal=)(\d+)(?=&)");
|
||||||
numVal = int.Parse(match.Value);
|
numVal = int.Parse(match.Value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -306,22 +306,22 @@ namespace Jackett.Common.Indexers
|
|||||||
if (limit == 0)
|
if (limit == 0)
|
||||||
limit = 100;
|
limit = 100;
|
||||||
|
|
||||||
if (start_page == 1)
|
if (startPage == 1)
|
||||||
{
|
{
|
||||||
releases = parseTorrents(results, seasonep, query, releases.Count, limit, previously_parsed_on_page);
|
releases = parseTorrents(results, seasonep, query, releases.Count, limit, previouslyParsedOnPage);
|
||||||
previously_parsed_on_page = 0;
|
previouslyParsedOnPage = 0;
|
||||||
start_page++;
|
startPage++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check all the pages for the torrents.
|
// Check all the pages for the torrents.
|
||||||
// The starting index is 2. (the first one is the original where we parse out the pages.)
|
// The starting index is 2. (the first one is the original where we parse out the pages.)
|
||||||
for (var i = start_page; (i <= numVal && releases.Count < limit); i++)
|
for (var i = startPage; (i <= numVal && releases.Count < limit); i++)
|
||||||
{
|
{
|
||||||
pairs.Add(new KeyValuePair<string, string>("oldal", i.ToString()));
|
pairs.Add(new KeyValuePair<string, string>("oldal", i.ToString()));
|
||||||
results = await PostDataWithCookiesAndRetry(SearchUrl, pairs);
|
results = await PostDataWithCookiesAndRetry(SearchUrl, pairs);
|
||||||
releases.AddRange(parseTorrents(results, seasonep, query, releases.Count, limit, previously_parsed_on_page));
|
releases.AddRange(parseTorrents(results, seasonep, query, releases.Count, limit, previouslyParsedOnPage));
|
||||||
previously_parsed_on_page = 0;
|
previouslyParsedOnPage = 0;
|
||||||
pairs.Remove(new KeyValuePair<string, string>("oldal", i.ToString()));
|
pairs.Remove(new KeyValuePair<string, string>("oldal", i.ToString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user