Add price extraction and validate URL structure in parsers

Added price field to Item struct in AisleGopher and implemented logic to extract price data. Updated Wegmans parser to validate URL structure by ensuring the second segment is "product". These changes improve data accuracy and error handling.
This commit is contained in:
2025-01-20 13:00:59 -05:00
parent f37e60dddc
commit 6de455b1bd
2 changed files with 16 additions and 2 deletions

View File

@@ -53,6 +53,10 @@ func (c Config) GetItemPrice(ctx context.Context, b extractor.Browser, u *url.UR
return Item{}, ErrInvalidURL
}
if a[1] != "product" {
return Item{}, ErrInvalidURL
}
id, _ := strconv.Atoi(a[2])
if id == 0 {