Skip to content

🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev

Fixing the functions-based filtering logic

Karim shoair4b2814404aec
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)