Skip to content

Python scraper based on AI

Merge branch 'pre/beta' into feat_chromium_scroller

Marco Vinciguerrac396dcf93b2f
diff --cc scrapegraphai/docloaders/chromium.py
index 3bb901b7,255fc3c2..f61f4d51
--- a/scrapegraphai/docloaders/chromium.py
+++ b/scrapegraphai/docloaders/chromium.py
@@@ -256,12 -132,13 +263,13 @@@ class ChromiumLoader(BaseLoader)
attempt += 1
logger.error(f"Attempt {attempt} failed: {e}")
if attempt == self.RETRY_LIMIT:
- raise RuntimeError(
- f"Failed to fetch {url} after {self.RETRY_LIMIT} attempts: {e}"
- )
+ results = f"Error: Network error after {self.RETRY_LIMIT} attempts - {e}"
finally:
- if "browser" in locals():
+ await browser.close()
+
+ return results
+
async def ascrape_with_js_support(self, url: str) -> str:
"""
Asynchronously scrape the content of a given URL by rendering JavaScript using Playwright.