From 9b130c3e5a1982cc92647a2ff51bcf6b5b9d4382 Mon Sep 17 00:00:00 2001 From: Diego Heras Date: Fri, 24 Apr 2020 19:44:24 +0200 Subject: [PATCH] awesomehd: remove the year from the search (#8342) Part of #7829 --- src/Jackett.Common/Indexers/AwesomeHD.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Jackett.Common/Indexers/AwesomeHD.cs b/src/Jackett.Common/Indexers/AwesomeHD.cs index 21893e3e7..b4f196b41 100644 --- a/src/Jackett.Common/Indexers/AwesomeHD.cs +++ b/src/Jackett.Common/Indexers/AwesomeHD.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Xml.Linq; using Jackett.Common.Models; @@ -18,6 +19,7 @@ namespace Jackett.Common.Indexers { private string SearchUrl => SiteLink + "searchapi.php"; private string TorrentUrl => SiteLink + "torrents.php"; + private readonly Regex _removeYearRegex = new Regex(@" [\(\[]?(19|20)\d{2}[\)\]]?$", RegexOptions.Compiled); private new ConfigurationDataPasskey configData => (ConfigurationDataPasskey)base.configData; public AwesomeHD(IIndexerConfigurationService configService, Utils.Clients.WebClient c, Logger l, IProtectionService ps) @@ -75,10 +77,13 @@ namespace Jackett.Common.Indexers } else if (!string.IsNullOrWhiteSpace(query.GetQueryString())) { - var searchTerm = query.SearchTerm; // not use query.GetQueryString(), because it includes the season - if (query.Season > 0) // search for tv series + // not use query.GetQueryString(), because it includes the season + var searchTerm = query.SearchTerm; + // search for tv series + if (query.Season > 0) searchTerm += $": Season {query.Season:D2}"; - + // remove the year, it's not supported in the api + searchTerm = _removeYearRegex.Replace(searchTerm, ""); qc.Add("action", "titlesearch"); qc.Add("title", searchTerm); }