Refine selectors and enhance price parsing with logging
Adjusted HTML selectors for improved compatibility and updated price parsing logic to handle additional formats. Added logging to provide better debugging insights during price extraction.
This commit is contained in:
@@ -62,13 +62,13 @@ func (c Config) GetItemFromURL(ctx context.Context, b extractor.Browser, u *url.
|
||||
return res, fmt.Errorf("failed to open page: %w", err)
|
||||
}
|
||||
|
||||
names := doc.Select("h2.h4")
|
||||
names := doc.Select(".h4")
|
||||
|
||||
if len(names) > 0 {
|
||||
res.Name, _ = names[0].Text()
|
||||
}
|
||||
|
||||
prices := doc.Select("h4.h2")
|
||||
prices := doc.Select(".h2")
|
||||
|
||||
if len(prices) > 0 {
|
||||
priceStr, _ := prices[0].Text()
|
||||
|
Reference in New Issue
Block a user