fix: Use - instead of ! to filter unwanted elements

This commit is contained in:
Arik Jones (aider)
2024-09-14 16:53:42 -05:00
parent e50484a6fa
commit d66fd04016
2 changed files with 2 additions and 2 deletions

View File

@@ -32,7 +32,7 @@ func init() {
webCmd.Flags().StringSliceVarP(&urls, "urls", "u", []string{}, "URLs of the webpages to scrape (comma-separated)")
webCmd.Flags().StringVarP(&outputFile, "output", "o", "", "Output Markdown file (default: rollup-web-<timestamp>.md)")
webCmd.Flags().IntVarP(&depth, "depth", "d", 0, "Depth of link traversal (default: 0, only scrape the given URLs)")
webCmd.Flags().StringVar(&cssSelector, "css", "", "CSS selector to extract specific content")
webCmd.Flags().StringVar(&cssSelector, "css", "", "CSS selector to extract specific content (use '-' to exclude elements, e.g., 'main - .ads - .navigation')")
}
func runWeb(cmd *cobra.Command, args []string) error {

View File

@@ -273,7 +273,7 @@ func ExtractContentWithCSS(content, selector string) (string, error) {
// parseSelectors splits the CSS selector string into include and exclude parts
func parseSelectors(selector string) (string, []string) {
parts := strings.Split(selector, "!")
parts := strings.Split(selector, "-")
includeSelector := strings.TrimSpace(parts[0])
var excludeSelectors []string
for _, part := range parts[1:] {