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__(
29
29
backend : str = "playwright" ,
30
30
headless : bool = True ,
31
31
proxy : Optional [Proxy ] = None ,
32
+ load_state : str = "domcontentloaded" ,
32
33
** kwargs : Any ,
33
34
):
34
35
"""Initialize the loader with a list of URL paths.
@@ -55,6 +56,7 @@ def __init__(
55
56
self .headless = headless
56
57
self .proxy = parse_or_search_proxy (proxy ) if proxy else None
57
58
self .urls = urls
59
+ self .load_state = load_state
58
60
59
61
async def ascrape_playwright (self , url : str ) -> str :
60
62
"""
@@ -81,6 +83,7 @@ async def ascrape_playwright(self, url: str) -> str:
81
83
await Malenia .apply_stealth (context )
82
84
page = await context .new_page ()
83
85
await page .goto (url )
86
+ await page .wait_for_load_state (self .load_state )
84
87
results = await page .content () # Simply get the HTML content
85
88
logger .info ("Content scraped" )
86
89
except Exception as e :
You can’t perform that action at this time.
0 commit comments