From 4b2814404aec933772f57d38c2db5c71776ba573 Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Sat, 9 Nov 2024 22:32:05 +0200 Subject: [PATCH] Fixing the functions-based filtering logic --- scrapling/parser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scrapling/parser.py b/scrapling/parser.py index 6530c68..cac7fef 100644 --- a/scrapling/parser.py +++ b/scrapling/parser.py @@ -633,8 +633,9 @@ class Adaptor(SelectorsGeneration): for pattern in patterns: results.extend(self.find_by_regex(pattern, first_match=False)) - for function in functions: - _search_tree(self, function) + for result in (results or [self]): + for function in functions: + _search_tree(result, function) return self.__convert_results(results)