Update Nordicbits - Add support for all themes (#3801)

Last commit of nordicbits.cs only supported the 'old' v2 theme.
With this new update, I have added support for the v3 theme but continue to keep the old support for v2 by looking after the .css file loaded and return the proper _fDom in FindTorrentRows...

I have also added a extended error msg, when torrents can't be found that it could be because of an unsupported theme.
This commit is contained in:
hallengreenn 2018-09-14 22:04:13 +02:00 committed by garfield69
parent 5d4e0c41d6
commit 53b6285810
1 changed files with 18 additions and 4 deletions

View File

@ -321,7 +321,7 @@ namespace Jackett.Common.Indexers
if (torrentRowList.Count == 0)
{
// No results found
Output("\nNo result found for your query, please try another search term ...\n", "info");
Output("\nNo result found for your query, please try another search term or change the theme you're currently using on the site as this is an unsupported solution...\n", "info");
// No result found for this query
break;
@ -678,9 +678,23 @@ namespace Jackett.Common.Indexers
/// <returns>JQuery Object</returns>
private CQ FindTorrentRows()
{
// Return all occurencis of torrents found
//return _fDom["#content > table > tr"];
return _fDom["# base_content > table.mainouter > tbody > tr > td.outer > div.article > table > tbody > tr:not(:first)"];
var defaultTheme = new[] { "/templates/1/", "/templates/2/", "/templates/3/", "/templates/4/", "/templates/5/", "/templates/6/", "/templates/11/", "/templates/12/" };
var oldV2 = new[] { "/templates/7/", "/templates/8/", "/templates/9/", "/templates/10/", "/templates/14/" };
if (defaultTheme.Any(_fDom.Document.Body.InnerHTML.Contains))
{
// Return all occurencis of torrents found
// $('#base_content2 > div.article > table > tbody:not(:first) > tr')
return _fDom["# base_content2 > div.article > table > tbody:not(:first) > tr"];
}
if (oldV2.Any(_fDom.Document.Body.InnerHTML.Contains))
{
// Return all occurencis of torrents found
// $('#base_content > table.mainouter > tbody > tr > td.outer > div.article > table > tbody')
return _fDom["# base_content > table.mainouter > tbody > tr > td.outer > div.article > table > tbody > tr:not(:first)"];
}
return _fDom;
}
/// <summary>