nordicbits: fix title, imdb search and dead torrents. resolves #8178 (#8343)

This commit is contained in:
Diego Heras 2020-04-25 03:32:02 +02:00 committed by GitHub
parent 70f1e64993
commit 20471ba9d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 24 deletions

View File

@ -358,7 +358,7 @@ namespace Jackett.Common.Indexers
Output("ID: " + id);
// Release Name
var name = row.QuerySelector("td:nth-of-type(2) > a:nth-of-type(1)").TextContent;
var name = row.QuerySelector("td:nth-of-type(2) > a:nth-of-type(1)").TextContent.Trim();
// Category
var categoryId = row.QuerySelector("td:nth-of-type(1) > a:nth-of-type(1)").GetAttribute("href").Split('?').Last();
@ -457,35 +457,29 @@ namespace Jackett.Common.Indexers
/// <summary>
/// Build query to process
/// </summary>
/// <param name="term">Term to search</param>
/// <param name="searchTerm">Term to search</param>
/// <param name="query">Torznab Query for categories mapping</param>
/// <param name="url">Search url for provider</param>
/// <param name="page">Page number to request</param>
/// <returns>URL to query for parsing and processing results</returns>
private string BuildQuery(string term, TorznabQuery query, string url, int page = 0)
private string BuildQuery(string searchTerm, TorznabQuery query, string url, int page = 0)
{
var parameters = new NameValueCollection();
var categoriesList = MapTorznabCapsToTrackers(query);
var searchterm = term;
// Building our tracker query
parameters.Add("searchin", "title");
parameters.Add("incldead", "0");
// If search term provided
if (!string.IsNullOrWhiteSpace(query.ImdbID))
var qc = new NameValueCollection
{
searchterm = "imdbsearch=" + query.ImdbID;
}
else if (!string.IsNullOrWhiteSpace(term))
{"incldead", "1"}
};
if (query.IsImdbQuery)
{
searchterm = "search=" + WebUtilityHelpers.UrlEncode(term, Encoding.GetEncoding(28591));
qc.Add("searchin", "imdb");
qc.Add("search", query.ImdbID);
}
else
{
// Showing all torrents (just for output function)
searchterm = "search=";
term = "all";
qc.Add("searchin", "title");
qc.Add("search", searchTerm);
}
// Loop on categories and change the catagories for search purposes
@ -523,15 +517,10 @@ namespace Jackett.Common.Indexers
}
}
// Build category search string
var CatQryStr = "";
foreach (var cat in categoriesList)
CatQryStr += cat + "&";
// Building our query
url += "?" + CatQryStr + searchterm + "&" + parameters.GetQueryString();
url += "?" + qc.GetQueryString() + "&" + string.Join("&", categoriesList);
Output("\nBuilded query for \"" + term + "\"... " + url);
Output("\nBuilt query for \"" + searchTerm + "\"... " + url);
// Return our search url
return url;