From c3955a119eab8047b825078a8cbd90464474bb01 Mon Sep 17 00:00:00 2001 From: Pontus Wiberg Date: Thu, 9 May 2024 13:39:22 +0300 Subject: [PATCH] Don't rescrape the same page --- pkg/scraper/scrapers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/scraper/scrapers.go b/pkg/scraper/scrapers.go index a1a93fc..b0b37f4 100644 --- a/pkg/scraper/scrapers.go +++ b/pkg/scraper/scrapers.go @@ -78,6 +78,10 @@ func (bs *BaseScraper) Scrape(maxWorkers int) ([]models.Product, error) { break // Exit loop if there's no next URL } + if nextURL == currentURL { + break // Exit loop if the next URL is the same as the current URL + } + currentURL = nextURL } }(url)