mirror of
https://github.com/tnypxl/rollup.git
synced 2025-12-15 23:13:22 +00:00
fix: Remove references to non-existent CSSLocator field in Config struct
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -218,17 +219,7 @@ func ProcessHTMLContent(htmlContent string, config Config) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
selection := doc.Find("body")
|
selection := doc.Find("body")
|
||||||
if config.CSSLocator != "" {
|
log.Println("Processing entire body")
|
||||||
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")
|
|
||||||
}
|
|
||||||
|
|
||||||
if selection.Length() == 0 {
|
if selection.Length() == 0 {
|
||||||
return "", fmt.Errorf("no content found in the document")
|
return "", fmt.Errorf("no content found in the document")
|
||||||
|
|||||||
3
main.go
3
main.go
@@ -30,7 +30,8 @@ func main() {
|
|||||||
defer scraper.ClosePlaywright()
|
defer scraper.ClosePlaywright()
|
||||||
|
|
||||||
scraperConfig := scraper.Config{
|
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
|
Verbose: false, // Set default verbosity
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user