From bffa21c9512e6eb89d61bf2870e973290b34865c Mon Sep 17 00:00:00 2001 From: Diego Heras Date: Wed, 8 Dec 2021 03:32:48 +0100 Subject: [PATCH] cinecalidad: new layout and castellano language (#12676) --- src/Jackett.Common/Indexers/Cinecalidad.cs | 40 +++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/src/Jackett.Common/Indexers/Cinecalidad.cs b/src/Jackett.Common/Indexers/Cinecalidad.cs index 87c1e95e2..72cda16ea 100644 --- a/src/Jackett.Common/Indexers/Cinecalidad.cs +++ b/src/Jackett.Common/Indexers/Cinecalidad.cs @@ -22,8 +22,10 @@ namespace Jackett.Common.Indexers { private const int MaxItemsPerPage = 15; private const int MaxSearchPageLimit = 6; // 15 items per page * 6 pages = 90 + private string _language; public override string[] LegacySiteLinks { get; protected set; } = { + "https://cinecalidad.website/", "https://www.cinecalidad.to/", "https://www.cinecalidad.im/", // working but outdated, maybe copycat "https://www.cinecalidad.is/", @@ -39,8 +41,8 @@ namespace Jackett.Common.Indexers ICacheService cs) : base(id: "cinecalidad", name: "Cinecalidad", - description: "Películas Full HD en Latino y Inglés Dual.", - link: "https://cinecalidad.website/", + description: "Películas Full HD en Castellano y Latino Dual.", + link: "https://www.cinecalidad.lat/", caps: new TorznabCapabilities { MovieSearchParams = new List { MovieSearchParam.Q } @@ -56,9 +58,29 @@ namespace Jackett.Common.Indexers Language = "es-ES"; Type = "public"; + var language = new ConfigurationData.SingleSelectConfigurationItem( + "Select language", new Dictionary + { + {"castellano", "Castilian Spanish"}, + {"latino", "Latin American Spanish"} + }) + { + Value = "castellano" + }; + configData.AddDynamic("language", language); + AddCategoryMapping(1, TorznabCatType.MoviesHD); } + public override void LoadValuesFromJson(JToken jsonConfig, bool useProtectionService = false) + { + { + base.LoadValuesFromJson(jsonConfig, useProtectionService); + var language = (ConfigurationData.SingleSelectConfigurationItem)configData.GetDynamic("language"); + _language = language?.Value ?? "castellano"; + } + } + public override async Task ApplyConfiguration(JToken configJson) { LoadValuesFromJson(configJson); @@ -75,6 +97,8 @@ namespace Jackett.Common.Indexers var releases = new List(); var templateUrl = SiteLink; + if (_language.Equals("castellano")) + templateUrl += "espana/"; templateUrl += "{0}?s="; // placeholder for page var maxPages = 2; // we scrape only 2 pages for recent torrents @@ -115,7 +139,12 @@ namespace Jackett.Common.Indexers { var parser = new HtmlParser(); var dom = parser.ParseDocument(results.ContentString); - var protectedLink = dom.QuerySelector("li:contains('Torrent')").ParentElement.GetAttribute("href"); + var linkParent = dom.QuerySelector("li:contains('Torrent')").ParentElement; + var protectedLink = linkParent.GetAttribute("data-res"); + if (protectedLink != null) + protectedLink = "protect/v.php?i=" + protectedLink; + else + protectedLink = linkParent.GetAttribute("href"); if (protectedLink.Contains("/ouo.io/")) { // protected link => @@ -156,9 +185,10 @@ namespace Jackett.Common.Indexers var title = qImg.GetAttribute("title"); if (!CheckTitleMatchWords(query.GetQueryString(), title)) continue; // skip if it doesn't contain all words - title += " MULTi LATiN SPANiSH 1080p BDRip x264"; + title += _language.Equals("castellano") ? " MULTi/SPANiSH" : " MULTi/LATiN SPANiSH"; + title += " 1080p BDRip x264"; - var poster = new Uri(GetAbsoluteUrl(qImg.GetAttribute("data-large"))); + var poster = new Uri(GetAbsoluteUrl(qImg.GetAttribute("data-src"))); var link = new Uri(row.QuerySelector("a.postItem__back-link").GetAttribute("href")); var release = new ReleaseInfo