This commit is contained in:
parent
dc257c195b
commit
4aa4daa295
2 changed files with 3 additions and 1 deletions
|
|
@ -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()
|
||||||
|
|
|
||||||
|
|
@ -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)),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue