fix err handling
Some checks failed
dev test / test (push) Successful in 1m20s
dev test / vulnCheck (push) Successful in 32s
dev test / Ci-Lint (push) Successful in 28s
${{ github.actor }} executed Build Push Prod / build (push) Failing after 37s
${{ github.actor }} executed Build Push Prod / deploy (push) Has been skipped
Some checks failed
dev test / test (push) Successful in 1m20s
dev test / vulnCheck (push) Successful in 32s
dev test / Ci-Lint (push) Successful in 28s
${{ github.actor }} executed Build Push Prod / build (push) Failing after 37s
${{ github.actor }} executed Build Push Prod / deploy (push) Has been skipped
This commit is contained in:
parent
a3f211254b
commit
98dce2d47c
@ -4,8 +4,6 @@ ARG version=not-set
|
||||
ARG SHORTSHA=not-set
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
ENV GOPRIVATE=git.maximotejeda.com/maximo,github.com/maximotejeda
|
||||
ENV GOPROXY=direct
|
||||
# https://stackoverflow.com/questions/70369368/check-architecture-in-dockerfile-to-get-amd-arm
|
||||
RUN go build -o bin/crawler \
|
||||
-ldflags "-X main.Shortsha=${SHORTSHA} \
|
||||
|
||||
@ -30,8 +30,8 @@ func (a Apap) Scrape(ctx context.Context, page playwright.Page, log *slog.Logger
|
||||
return nil, err
|
||||
}
|
||||
button := page.Locator("#exchangesRates")
|
||||
button.WaitFor()
|
||||
button.Click()
|
||||
_ = button.WaitFor()
|
||||
_ = button.Click()
|
||||
|
||||
compraLocator := page.Locator("#currency-buy-USD")
|
||||
ventaLocator := page.Locator("#currency-sell-USD")
|
||||
|
||||
@ -31,7 +31,7 @@ func (b bcd) Scrape(ctx context.Context, page playwright.Page, log *slog.Logger)
|
||||
}
|
||||
compraLocator := page.Locator("span#actualPurchaseValue")
|
||||
|
||||
compraLocator.WaitFor(playwright.LocatorWaitForOptions{
|
||||
_ = compraLocator.WaitFor(playwright.LocatorWaitForOptions{
|
||||
Timeout: &tout,
|
||||
State: playwright.WaitForSelectorStateVisible,
|
||||
})
|
||||
|
||||
@ -35,9 +35,9 @@ func (bd brd) Scrape(ctx context.Context, page playwright.Page, log *slog.Logger
|
||||
return nil, err
|
||||
}
|
||||
|
||||
page.Locator("section#divisas").WaitFor()
|
||||
_ = page.Locator("section#divisas").WaitFor()
|
||||
compraLocator := page.Locator("span#compraUS")
|
||||
compraLocator.WaitFor()
|
||||
_ = compraLocator.WaitFor()
|
||||
ventaLocator := page.Locator("span#ventaUS")
|
||||
compraSTR, err := compraLocator.TextContent()
|
||||
if err != nil {
|
||||
|
||||
@ -46,7 +46,7 @@ func (bh bhd) Scrape(ctx context.Context, page playwright.Page, log *slog.Logger
|
||||
}
|
||||
|
||||
fieldGroupLocator := page.Locator("div.field_group")
|
||||
fieldGroupLocator.WaitFor()
|
||||
_ = fieldGroupLocator.WaitFor()
|
||||
fieldGroup, err := fieldGroupLocator.All()
|
||||
//log.Info("divs", "number", len(fieldGroup))
|
||||
if err != nil {
|
||||
|
||||
@ -31,7 +31,7 @@ func (bn bnc) Scrape(ctx context.Context, page playwright.Page, log *slog.Logger
|
||||
}
|
||||
|
||||
currencyDiv := page.Locator(".calculator__content")
|
||||
currencyDiv.WaitFor()
|
||||
_ = currencyDiv.WaitFor()
|
||||
|
||||
buyInput := page.Locator("div.calculator__buy-input:nth-child(2) > input:nth-child(2)")
|
||||
|
||||
|
||||
@ -35,15 +35,15 @@ func (bp bpd) Scrape(ctx context.Context, page playwright.Page, log *slog.Logger
|
||||
//log.Info("Page loaded", "time", time.Since(start).Seconds())
|
||||
// menu := page.Locator(".footer_est_menu_bpd > li:nth-child(3)")
|
||||
container := page.Locator("div.tasa.tasa_dolar")
|
||||
container.WaitFor()
|
||||
_ = container.WaitFor()
|
||||
compraInput := page.Locator("input#compra_peso_dolar")
|
||||
compraInput.WaitFor(playwright.LocatorWaitForOptions{
|
||||
_ = compraInput.WaitFor(playwright.LocatorWaitForOptions{
|
||||
Timeout: &tout,
|
||||
State: playwright.WaitForSelectorStateVisible,
|
||||
})
|
||||
|
||||
ventaInput := page.Locator("input#venta_peso_dolar")
|
||||
ventaInput.WaitFor()
|
||||
_ = ventaInput.WaitFor()
|
||||
compraSTR, err := compraInput.InputValue()
|
||||
if err != nil {
|
||||
log.Error("compra value", "err", err)
|
||||
@ -81,5 +81,5 @@ func (bp bpd) Scrape(ctx context.Context, page playwright.Page, log *slog.Logger
|
||||
|
||||
func HoverTasas(page playwright.Page) {
|
||||
tasasMenu := page.Locator(".footer_est_menu_bpd > li:nth-child(3)")
|
||||
tasasMenu.Hover()
|
||||
_ = tasasMenu.Hover()
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ func Selector(who string, client ports.DollarPort) (ports.APIPorts, error) {
|
||||
case "vimenca":
|
||||
parser = NewVimenca()
|
||||
default:
|
||||
return nil, fmt.Errorf("not recognize who: " + who)
|
||||
return nil, fmt.Errorf("not recognize who: %s", who)
|
||||
}
|
||||
return parser, nil
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ func (in inf) Scrape(ctx context.Context, page playwright.Page, log *slog.Logger
|
||||
}
|
||||
|
||||
entriesLocator := page.Locator("table#Dolar > tbody > tr")
|
||||
entriesLocator.WaitFor(playwright.LocatorWaitForOptions{
|
||||
_ = entriesLocator.WaitFor(playwright.LocatorWaitForOptions{
|
||||
Timeout: &tout,
|
||||
State: playwright.WaitForSelectorStateVisible,
|
||||
})
|
||||
|
||||
@ -32,7 +32,7 @@ func (sct scotia) Scrape(ctx context.Context, page playwright.Page, log *slog.Lo
|
||||
}
|
||||
|
||||
currencyTable := page.Locator(".bns--table")
|
||||
currencyTable.WaitFor()
|
||||
_ = currencyTable.WaitFor()
|
||||
|
||||
firstRow := page.Locator(".bns--table > tbody:nth-child(1) > tr:nth-child(2)")
|
||||
secondRow := page.Locator(".bns--table > tbody:nth-child(1) > tr:nth-child(3)")
|
||||
|
||||
@ -30,7 +30,7 @@ func (v vimenca) Scrape(ctx context.Context, page playwright.Page, log *slog.Log
|
||||
}
|
||||
|
||||
currencyTable := page.Locator(".bns--table")
|
||||
currencyTable.WaitFor()
|
||||
_ = currencyTable.WaitFor()
|
||||
|
||||
infoContainer := page.Locator(".layout-uikit > div:nth-child(1)")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user