From 4f0bdb5069df09e5f4064473fdb7d24403104c23 Mon Sep 17 00:00:00 2001 From: toshski <104477758+toshski@users.noreply.github.com> Date: Sat, 25 Nov 2023 01:12:12 +1300 Subject: [PATCH] scraper: Fix trailers for VRLatina (#1506) --- pkg/api/trailers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/api/trailers.go b/pkg/api/trailers.go index 8794b1e08..48fd8ae28 100644 --- a/pkg/api/trailers.go +++ b/pkg/api/trailers.go @@ -70,7 +70,7 @@ func ScrapeHtml(scrapeParams string) models.VideoSourceResponse { origURLtmp := e.Attr(params.ContentPath) quality := e.Attr(params.QualityPath) if origURLtmp != "" { - if params.ContentBaseUrl != "" { + if params.ContentBaseUrl != "" && !strings.HasPrefix(origURLtmp, params.ContentBaseUrl) { origURLtmp = params.ContentBaseUrl + origURLtmp } srcs = append(srcs, models.VideoSource{URL: origURLtmp, Quality: quality}) @@ -174,7 +174,7 @@ func extractFromJson(inputJson string, params models.TrailerScrape, srcs []model if params.EncodingPath != "" { encoding = gjson.Get(JsonMetadata, params.EncodingPath).String() + "-" } - if params.ContentBaseUrl != "" { + if params.ContentBaseUrl != "" && !strings.HasPrefix(url, params.ContentBaseUrl) { if params.ContentBaseUrl[len(params.ContentBaseUrl)-1:] == "/" && string(url[0]) == "/" { url = params.ContentBaseUrl + url[1:] } else {