From 63b20c1aa7104b8346cc20bcc7d6890a4fdffdf5 Mon Sep 17 00:00:00 2001 From: Diego Heras Date: Tue, 22 Dec 2020 18:21:00 +0100 Subject: [PATCH] cinecalidad: fix relative links. resolves #10595 (#10607) --- src/Jackett.Common/Indexers/Cinecalidad.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Jackett.Common/Indexers/Cinecalidad.cs b/src/Jackett.Common/Indexers/Cinecalidad.cs index e4e970c65..092bb0aea 100644 --- a/src/Jackett.Common/Indexers/Cinecalidad.cs +++ b/src/Jackett.Common/Indexers/Cinecalidad.cs @@ -142,8 +142,7 @@ namespace Jackett.Common.Indexers var linkParts = protectedLink.Split('='); protectedLink = protectedLink.Replace(linkParts[0] + "=", ""); } - if (protectedLink.StartsWith("/")) - protectedLink = SiteLink + protectedLink.TrimStart('/'); + protectedLink = GetAbsoluteUrl(protectedLink); results = await RequestWithCookiesAsync(protectedLink); dom = parser.ParseDocument(results.ContentString); @@ -179,8 +178,8 @@ namespace Jackett.Common.Indexers title += _language.Equals("castellano") ? " MULTi/SPANiSH" : " MULTi/LATiN SPANiSH"; title += " 1080p BDRip x264"; - var poster = new Uri(qImg.GetAttribute("src")); - var link = new Uri(row.QuerySelector("a").GetAttribute("href")); + var poster = new Uri(GetAbsoluteUrl(qImg.GetAttribute("src"))); + var link = new Uri(GetAbsoluteUrl(row.QuerySelector("a").GetAttribute("href"))); var release = new ReleaseInfo { @@ -226,6 +225,14 @@ namespace Jackett.Common.Indexers return queryWords.All(word => titleWords.Contains(word)); } + + private string GetAbsoluteUrl(string url) + { + url = url.Trim(); + if (!url.StartsWith("http")) + return SiteLink + url.TrimStart('/'); + return url; + } } }