From 645d2549f9445670cd61cd96467f546ff96ae877 Mon Sep 17 00:00:00 2001 From: jakopako Date: Tue, 28 Nov 2023 19:45:44 +0100 Subject: [PATCH] fixed issue #258 --- scraper/scraper.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scraper/scraper.go b/scraper/scraper.go index c969914..3d9ad35 100644 --- a/scraper/scraper.go +++ b/scraper/scraper.go @@ -832,10 +832,6 @@ func getTextString(e *ElementLocation, s *goquery.Selection) (string, error) { } fieldStrings[i] = fieldString } - // automatically trimming whitespaces might be confusing in some cases... - for i, f := range fieldStrings { - fieldStrings[i] = strings.TrimSpace(f) - } // regex extract for i, f := range fieldStrings { fieldString, err := extractStringRegex(&e.RegexExtract, f) @@ -844,6 +840,11 @@ func getTextString(e *ElementLocation, s *goquery.Selection) (string, error) { } fieldStrings[i] = fieldString } + // automatically trimming whitespaces might be confusing in some cases... + // TODO make this configurable + for i, f := range fieldStrings { + fieldStrings[i] = strings.TrimSpace(f) + } // shortening for i, f := range fieldStrings { fieldStrings[i] = utils.ShortenString(f, e.MaxLength)