fix: Remove references to non-existent CSSLocator field in Config struct

This commit is contained in:
Arik Jones (aider)
2024-09-14 20:36:31 -05:00
parent 52c7de255d
commit 6f4750c900
2 changed files with 4 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ import (
"io/ioutil"
"log"
"math/rand"
"regexp"
"strings"
"time"
@@ -218,17 +219,7 @@ func ProcessHTMLContent(htmlContent string, config Config) (string, error) {
}
selection := doc.Find("body")
if config.CSSLocator != "" {
log.Printf("Using CSS locator: %s\n", config.CSSLocator)
tempSelection := doc.Find(config.CSSLocator)
if tempSelection.Length() > 0 {
selection = tempSelection
} else {
log.Printf("Warning: No content found with CSS locator: %s. Falling back to body content.\n", config.CSSLocator)
}
} else {
log.Println("No CSS locator provided, processing entire body")
}
log.Println("Processing entire body")
if selection.Length() == 0 {
return "", fmt.Errorf("no content found in the document")

View File

@@ -30,7 +30,8 @@ func main() {
defer scraper.ClosePlaywright()
scraperConfig := scraper.Config{
CSSLocator: cfg.Scrape.CSSLocator,
URLs: []scraper.URLConfig{{URL: cfg.Scrape.URLs[0].URL}},
OutputType: cfg.Scrape.OutputType,
Verbose: false, // Set default verbosity
}