Skip to content

Commit

Permalink
chore: chromium browser asnc handling
Browse files Browse the repository at this point in the history
  • Loading branch information
PeriniM committed Jan 6, 2025
1 parent a82af04 commit 5be7c49
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions scrapegraphai/docloaders/chromium.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,13 @@ async def ascrape_playwright(self, url: str, browser_name: str = "chromium") ->
await page.wait_for_load_state(self.load_state)
results = await page.content()
logger.info("Content scraped")
await browser.close()
return results
except (aiohttp.ClientError, asyncio.TimeoutError, Exception) as e:
attempt += 1
logger.error(f"Attempt {attempt} failed: {e}")
if attempt == self.retry_limit:
raise RuntimeError(f"Failed to scrape after {self.retry_limit} attempts: {str(e)}")
finally:
await browser.close()

async def ascrape_with_js_support(self, url: str, browser_name: str = "chromium") -> str:
"""
Expand Down

0 comments on commit 5be7c49

Please sign in to comment.