File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ def __init__(
2929 backend : str = "playwright" ,
3030 headless : bool = True ,
3131 proxy : Optional [Proxy ] = None ,
32+ load_state : str = "domcontentloaded" ,
3233 ** kwargs : Any ,
3334 ):
3435 """Initialize the loader with a list of URL paths.
@@ -55,6 +56,7 @@ def __init__(
5556 self .headless = headless
5657 self .proxy = parse_or_search_proxy (proxy ) if proxy else None
5758 self .urls = urls
59+ self .load_state = load_state
5860
5961 async def ascrape_playwright (self , url : str ) -> str :
6062 """
@@ -81,6 +83,7 @@ async def ascrape_playwright(self, url: str) -> str:
8183 await Malenia .apply_stealth (context )
8284 page = await context .new_page ()
8385 await page .goto (url )
86+ await page .wait_for_load_state (self .load_state )
8487 results = await page .content () # Simply get the HTML content
8588 logger .info ("Content scraped" )
8689 except Exception as e :
You can’t perform that action at this time.
0 commit comments