From 1ec6f0e0f011c670b8f499c6c97124f8e0d07dff Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Sat, 2 Aug 2025 03:39:05 +0300 Subject: [PATCH] perf: optimizing `find_similar` method --- scrapling/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scrapling/parser.py b/scrapling/parser.py index 8146461..e3d30c6 100644 --- a/scrapling/parser.py +++ b/scrapling/parser.py @@ -1082,7 +1082,7 @@ class Selector(SelectorsGeneration): "src", ), match_text: bool = False, - ) -> Union["Selectors", List]: + ) -> "Selectors": """Find elements that are in the same tree depth in the page with the same tag name and same parent tag etc... then return the ones that match the current element attributes with a percentage higher than the input threshold. @@ -1136,7 +1136,7 @@ class Selector(SelectorsGeneration): ): similar_elements.append(potential_match) - return self.__handle_elements(similar_elements) + return Selectors(map(self.__element_convertor, similar_elements)) def find_by_text( self,