From b4209669afdebc5ec3a158b70c9ce2ddfaf6c393 Mon Sep 17 00:00:00 2001 From: JiangNan <1394485448@qq.com> Date: Sun, 8 Mar 2026 12:54:02 +0800 Subject: [PATCH] fix: use .search() instead of .match() for negative patterns in PruningContentFilter Signed-off-by: JiangNan <1394485448@qq.com> --- crawl4ai/content_filter_strategy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crawl4ai/content_filter_strategy.py b/crawl4ai/content_filter_strategy.py index 50baed276..d6d24ecbd 100644 --- a/crawl4ai/content_filter_strategy.py +++ b/crawl4ai/content_filter_strategy.py @@ -768,11 +768,11 @@ def _compute_class_id_weight(self, node): class_id_score = 0 if "class" in node.attrs: classes = " ".join(node["class"]) - if self.negative_patterns.match(classes): + if self.negative_patterns.search(classes): class_id_score -= 0.5 if "id" in node.attrs: element_id = node["id"] - if self.negative_patterns.match(element_id): + if self.negative_patterns.search(element_id): class_id_score -= 0.5 return class_id_score