extended navigation
All checks were successful
/ Make image (push) Successful in 38s

This commit is contained in:
nquidox 2025-12-26 18:17:26 +03:00
parent dc257c195b
commit 4aa4daa295
2 changed files with 3 additions and 1 deletions

View file

@ -37,7 +37,7 @@ func (s *Parser) worker(ctx context.Context, receiver chan shared.Task, sender c
for task := range receiver { for task := range receiver {
log.WithField("task_uuid", task.MerchUuid).Debug(logHeader + logWorker + "processing task") log.WithField("task_uuid", task.MerchUuid).Debug(logHeader + logWorker + "processing task")
pageCtx, pageCancel := chromedp.NewContext(ctx, chromedp.WithLogf(log.Printf)) pageCtx, pageCancel := chromedp.NewContext(ctx, chromedp.WithLogf(func(string, ...any) {}))
price, err := s.getPrice(pageCtx, task) price, err := s.getPrice(pageCtx, task)
pageCancel() pageCancel()

View file

@ -19,6 +19,8 @@ func (s *Parser) getPrice(ctx context.Context, task shared.Task) (int32, error)
) )
if err := chromedp.Run(ctx, if err := chromedp.Run(ctx,
chromedp.Navigate("https://www.mandarake.co.jp/index2.html"),
chromedp.WaitReady("body", chromedp.ByQuery),
chromedp.Navigate(task.Link), chromedp.Navigate(task.Link),
chromedp.WaitReady("body"), chromedp.WaitReady("body"),
chromedp.Text(`div.price`, &singlePrice, chromedp.ByQuery, chromedp.AtLeast(0)), chromedp.Text(`div.price`, &singlePrice, chromedp.ByQuery, chromedp.AtLeast(0)),