mirror of
https://github.com/tnypxl/rollup.git
synced 2025-12-15 15:03:17 +00:00
fix: Use - instead of ! to filter unwanted elements
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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:] {
|
||||
|
||||
Reference in New Issue
Block a user