🕷️ 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
Python aiai-scrapingautomationcrawlercrawlingcrawling-pythondatadata-extractionmcpmcp-serverplaywrightpythonscrapingselectorsstealthweb-scraperweb-scrapingweb-scraping-pythonwebscrapingxpath
perf: wrap elements lazily in find_by_text/find_by_regex so first_match short-circuits
yetvalaeb0f8797fc3
diff --git a/scrapling/parser.py b/scrapling/parser.pyindex 8401f27..021265f 100644--- a/scrapling/parser.py+++ b/scrapling/parser.py@@ -1117,7 +1117,7 @@ class Selector(SelectorsGeneration):possible_targets = cast(List, _find_all_elements_with_spaces(self._root))if possible_targets:- for node in self.__elements_convertor(possible_targets):+ for node in map(self.__element_convertor, possible_targets):"""Check if element matches given text otherwise, traverse the children tree and iterate"""node_text: TextHandler = node.textif clean_match:@@ -1179,7 +1179,7 @@ class Selector(SelectorsGeneration):possible_targets = cast(List, _find_all_elements_with_spaces(self._root))if possible_targets:- for node in self.__elements_convertor(possible_targets):+ for node in map(self.__element_convertor, possible_targets):"""Check if element matches given regex otherwise, traverse the children tree and iterate"""node_text = node.textif node_text.re(