From 9495ddd788468b76455bf349c0ba19626433534a Mon Sep 17 00:00:00 2001 From: tnypxl Date: Thu, 27 Nov 2025 11:04:08 -0600 Subject: [PATCH] fix: resolve nil logger panic and CLI URL processing (#5) - Initialize logger before Playwright to prevent nil pointer dereference - Set AllowedPaths for CLI URLs so they get processed by scraper Co-authored-by: Claude --- cmd/web.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/web.go b/cmd/web.go index 7b67a96..e141555 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -29,6 +29,8 @@ var webCmd = &cobra.Command{ Short: "Scrape main content from webpages and convert to Markdown", Long: `Scrape the main content from one or more webpages, ignoring navigational elements, ads, and other UI aspects. Convert the content to a well-structured Markdown file.`, PreRunE: func(cmd *cobra.Command, args []string) error { + // Setup logger before initializing Playwright + scraper.SetupLogger(verbose) // Initialize Playwright for web scraping if err := scraper.InitPlaywright(); err != nil { return fmt.Errorf("failed to initialize Playwright: %w", err) @@ -83,6 +85,7 @@ func runWeb(cmd *cobra.Command, args []string) error { BaseURL: u, CSSLocator: includeSelector, ExcludeSelectors: excludeSelectors, + AllowedPaths: []string{""}, } logger.Printf("URL %d configuration: BaseURL=%s, CSSLocator=%s", i+1, u, includeSelector)