From 0c39616c12fdfd1c4136bc8d009991b4b5a8c2b5 Mon Sep 17 00:00:00 2001 From: Garfield69 Date: Tue, 12 Mar 2019 16:10:50 +1300 Subject: [PATCH] xspeeds: add imdbid search support for #4859 --- src/Jackett.Common/Indexers/XSpeeds.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Jackett.Common/Indexers/XSpeeds.cs b/src/Jackett.Common/Indexers/XSpeeds.cs index 61ff9a5b8..f93356e81 100644 --- a/src/Jackett.Common/Indexers/XSpeeds.cs +++ b/src/Jackett.Common/Indexers/XSpeeds.cs @@ -53,6 +53,8 @@ namespace Jackett.Common.Indexers configData.DisplayText.Value = "Expect an initial delay (often around 10 seconds) due to XSpeeds CloudFlare DDoS protection"; configData.DisplayText.Name = "Notice"; + TorznabCaps.SupportsImdbSearch = true; + AddCategoryMapping(92, TorznabCatType.MoviesUHD, "4K Movies"); AddCategoryMapping(91, TorznabCatType.TVUHD, "4K TV"); AddCategoryMapping(94, TorznabCatType.TVUHD, "4K TV Boxsets"); @@ -214,6 +216,8 @@ namespace Jackett.Common.Indexers var releases = new List(); var searchString = query.GetQueryString(); var prevCook = CookieHeader + ""; + Regex IMDBRegEx = new Regex(@"tt(\d+)", RegexOptions.Compiled); + var searchStringIsImdbQuery = (ParseUtil.GetImdbID(searchString) != null); // If we have no query use the RSS Page as their server is slow enough at times! // ~15.01.2019 they removed the description tag making the RSS feed almost useless, we don't use it for now. See #4458 @@ -286,11 +290,26 @@ namespace Jackett.Common.Indexers */ var searchParams = new Dictionary { { "do", "search" }, - { "keywords", searchString }, - { "search_type", "t_name" }, { "category", "0" }, { "include_dead_torrents", "no" } }; + + if (query.IsImdbQuery) + { + searchParams.Add("keywords", query.ImdbID); + searchParams.Add("search_type", "t_both"); + } + else if (searchStringIsImdbQuery) + { + searchParams.Add("keywords", searchString); + searchParams.Add("search_type", "t_both"); + } + else + { + searchParams.Add("keywords", searchString); + searchParams.Add("search_type", "t_name"); + } + var pairs = new Dictionary { { "username", configData.Username.Value }, { "password", configData.Password.Value }