From 85c4c4f170cdee0e5fb820adb9b5141b3740b26b Mon Sep 17 00:00:00 2001 From: ilike2burnthing <59480337+ilike2burnthing@users.noreply.github.com> Date: Tue, 12 Oct 2021 15:56:12 +0100 Subject: [PATCH] toloka: add search by categories (#12400) --- src/Jackett.Common/Indexers/Toloka.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Jackett.Common/Indexers/Toloka.cs b/src/Jackett.Common/Indexers/Toloka.cs index cf2a713c5..fbc7be58a 100644 --- a/src/Jackett.Common/Indexers/Toloka.cs +++ b/src/Jackett.Common/Indexers/Toloka.cs @@ -234,12 +234,16 @@ namespace Jackett.Common.Indexers var releases = new List(); var searchString = query.SanitizedSearchTerm; - var queryCollection = new NameValueCollection(); + var qc = new List> // 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")) {