toloka: add search by categories (#12400)

This commit is contained in:
ilike2burnthing 2021-10-12 15:56:12 +01:00 committed by GitHub
parent 9df84d76e7
commit 85c4c4f170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -234,12 +234,16 @@ namespace Jackett.Common.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm;
var queryCollection = new NameValueCollection();
var qc = new List<KeyValuePair<string, string>> // NameValueCollection don't support cat[]=19&cat[]=6
{
{"o", "1"},
{"s", "2"}
};
// if the search string is empty use the getnew view
if (string.IsNullOrWhiteSpace(searchString))
{
queryCollection.Add("nm", searchString);
qc.Add("nm", searchString);
}
else // use the normal search
{
@ -248,10 +252,13 @@ namespace Jackett.Common.Indexers
{
searchString += " Сезон " + query.Season;
}
queryCollection.Add("nm", searchString);
qc.Add("nm", searchString);
}
var searchUrl = SearchUrl + "?" + queryCollection.GetQueryString();
foreach (var cat in MapTorznabCapsToTrackers(query))
qc.Add("f[]", cat);
var searchUrl = SearchUrl + "?" + qc.GetQueryString();
var results = await RequestWithCookiesAsync(searchUrl);
if (!results.ContentString.Contains("logout=true"))
{