diff --git a/src/Jackett/Indexers/HDTorrents.cs b/src/Jackett/Indexers/HDTorrents.cs index da28d952b..0f2f5501c 100644 --- a/src/Jackett/Indexers/HDTorrents.cs +++ b/src/Jackett/Indexers/HDTorrents.cs @@ -21,29 +21,35 @@ namespace Jackett.Indexers { public class HDTorrents : BaseIndexer, IIndexer { - private string SearchUrl { get { return SiteLink + "torrents.php?"; } } - private string LoginUrl { get { return SiteLink + "login.php"; } } + private string UseLink { get { return (!String.IsNullOrEmpty(this.configData.AlternateLink.Value) ? this.configData.AlternateLink.Value : SiteLink); } } + private string SearchUrl { get { return UseLink + "torrents.php?"; } } + private string LoginUrl { get { return UseLink + "login.php"; } } private const int MAXPAGES = 3; + private List KnownURLs = new List { "https://hdts.ru/", "https://hd-torrents.org/", "https://hd-torrents.net/", "https://hd-torrents.me/" }; - new ConfigurationDataBasicLogin configData + new ConfigurationDataBasicLoginWithAlternateLink configData { - get { return (ConfigurationDataBasicLogin)base.configData; } + get { return (ConfigurationDataBasicLoginWithAlternateLink)base.configData; } set { base.configData = value; } } public HDTorrents(IIndexerManagerService i, Logger l, IWebClient w, IProtectionService ps) : base(name: "HD-Torrents", description: "HD-Torrents is a private torrent website with HD torrents and strict rules on their content.", - link: "http://hdts.ru/",// Of the accessible domains the .ru seems the most reliable. https://hdts.ru | https://hd-torrents.org | https://hd-torrents.net | https://hd-torrents.me + link: "https://hdts.ru/",// Of the accessible domains the .ru seems the most reliable. https://hdts.ru | https://hd-torrents.org | https://hd-torrents.net | https://hd-torrents.me manager: i, client: w, logger: l, p: ps, - configData: new ConfigurationDataBasicLogin()) + configData: new ConfigurationDataBasicLoginWithAlternateLink()) { Encoding = Encoding.GetEncoding("UTF-8"); Language = "en-us"; + this.configData.Instructions.Value = this.DisplayName + " has multiple URLs. The default (" + this.SiteLink + ") can be changed by entering a new value in the box below."; + this.configData.Instructions.Value += "The following are some known URLs for " + this.DisplayName; + this.configData.Instructions.Value += ""; + TorznabCaps.Categories.Clear(); AddCategoryMapping("1", TorznabCatType.MoviesHD);// Movie/Blu-Ray @@ -71,6 +77,9 @@ namespace Jackett.Indexers public async Task ApplyConfiguration(JToken configJson) { configData.LoadValuesFromJson(configJson); + if (!string.IsNullOrWhiteSpace(configData.AlternateLink.Value) && !configData.AlternateLink.Value.EndsWith("/")) + configData.AlternateLink.Value += "/"; + var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty); var pairs = new Dictionary {