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

perf(parser): skip re-walking nested ignored subtrees when building the ignored set

yetvaled0202fe3d39
diff --git a/scrapling/parser.py b/scrapling/parser.py
index 65924cc..065f005 100644
--- a/scrapling/parser.py
+++ b/scrapling/parser.py
@@ -301,7 +301,8 @@ class Selector(SelectorsGeneration):
ignored_elements: set[Any] = set()
if ignore_tags:
for element in self._root.iter(*ignore_tags):
- ignored_elements.update(element.iter())
+ if element not in ignored_elements:
+ ignored_elements.update(element.iter())
_all_strings = []