From 23334991b1a648484619e20607cf076c0a27026f Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Sat, 14 Dec 2024 00:50:25 -0500 Subject: [PATCH] make screenshot update cookies --- go.mod | 6 ++++-- playwright.go | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 7190b00..f73bdb9 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,10 @@ module gitea.stevedudenhoeffer.com/steve/go-extractor go 1.23.2 -require github.com/playwright-community/playwright-go v0.4802.0 +require ( + github.com/go-shiori/go-readability v0.0.0-20241012063810-92284fa8a71f + github.com/playwright-community/playwright-go v0.4802.0 +) require ( github.com/andybalholm/cascadia v1.3.2 // indirect @@ -10,7 +13,6 @@ require ( github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/go-jose/go-jose/v3 v3.0.3 // indirect github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c // indirect - github.com/go-shiori/go-readability v0.0.0-20241012063810-92284fa8a71f // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect golang.org/x/net v0.32.0 // indirect diff --git a/playwright.go b/playwright.go index bf4500b..7840fe6 100644 --- a/playwright.go +++ b/playwright.go @@ -256,6 +256,11 @@ func (b playWrightBrowser) Screenshot(ctx context.Context, url string, opts Scre } defer page.Close() + err = b.updateCookies(ctx, page) + if err != nil { + return nil, err + } + return b.getScreenshot(ctx, page, opts) }