🕷️ 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
Handling JSON responses better
Karim shoair942aa08c8502
diff --git a/scrapling/parser.py b/scrapling/parser.pyindex 2dd4f66..57a7529 100644--- a/scrapling/parser.py+++ b/scrapling/parser.py@@ -601,7 +601,10 @@ class Adaptor(SelectorsGeneration):# Operations on text functionsdef json(self) -> Dict:"""Return json response if the response is jsonable otherwise throws error"""- return self.text.json()+ if self.text:+ return self.text.json()+ else:+ return self.get_all_text(strip=True).json()def re(self, regex: Union[str, Pattern[str]], replace_entities: bool = True) -> 'List[str]':"""Apply the given regex to the current text and return a list of strings with the matches.