mirror of
https://github.com/tnypxl/rollup.git
synced 2025-12-15 23:13:22 +00:00
feat: Add support for exclusionary CSS paths in config.go
This commit is contained in:
@@ -49,6 +49,7 @@ func runWeb(cmd *cobra.Command, args []string) error {
|
|||||||
urlConfigs[i] = scraper.URLConfig{
|
urlConfigs[i] = scraper.URLConfig{
|
||||||
URL: u.URL,
|
URL: u.URL,
|
||||||
CSSLocator: u.CSSLocator,
|
CSSLocator: u.CSSLocator,
|
||||||
|
ExcludeSelectors: u.ExcludeSelectors,
|
||||||
OutputAlias: u.OutputAlias,
|
OutputAlias: u.OutputAlias,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ type ScrapeConfig struct {
|
|||||||
type URLConfig struct {
|
type URLConfig struct {
|
||||||
URL string `yaml:"url"`
|
URL string `yaml:"url"`
|
||||||
CSSLocator string `yaml:"css_locator"`
|
CSSLocator string `yaml:"css_locator"`
|
||||||
|
ExcludeSelectors []string `yaml:"exclude_selectors"`
|
||||||
OutputAlias string `yaml:"output_alias"`
|
OutputAlias string `yaml:"output_alias"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ func scrapeURL(config URLConfig) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if config.CSSLocator != "" {
|
if config.CSSLocator != "" {
|
||||||
content, err = ExtractContentWithCSS(content, config.CSSLocator, nil)
|
content, err = ExtractContentWithCSS(content, config.CSSLocator, config.ExcludeSelectors)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -99,6 +99,7 @@ func sanitizeFilename(name string) string {
|
|||||||
type URLConfig struct {
|
type URLConfig struct {
|
||||||
URL string
|
URL string
|
||||||
CSSLocator string
|
CSSLocator string
|
||||||
|
ExcludeSelectors []string
|
||||||
OutputAlias string
|
OutputAlias string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user