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

Correcting return type for `css_first` and `xpath_first`

Karim shoair5548941cf1d1
diff --git a/scrapling/parser.py b/scrapling/parser.py
index 4f994b4..52d9bcf 100644
--- a/scrapling/parser.py
+++ b/scrapling/parser.py
@@ -396,7 +396,7 @@ class Adaptor(SelectorsGeneration):
def css_first(self, selector: str, identifier: str = '',
auto_match: bool = False, auto_save: bool = False, percentage: int = 0
- ) -> Union['Adaptors[Adaptor]', List, None]:
+ ) -> Union['Adaptor', 'TextHandler', None]:
"""Search current tree with CSS3 selectors and return the first result if possible, otherwise return `None`
**Important:
@@ -421,7 +421,7 @@ class Adaptor(SelectorsGeneration):
def xpath_first(self, selector: str, identifier: str = '',
auto_match: bool = False, auto_save: bool = False, percentage: int = 0, **kwargs: Any
- ) -> Union['Adaptors[Adaptor]', List, None]:
+ ) -> Union['Adaptor', 'TextHandler', None]:
"""Search current tree with XPath selectors and return the first result if possible, otherwise return `None`
**Important: