mirror of
https://github.com/unclecode/crawl4ai.git
synced 2026-06-10 15:58:15 +00:00
fix: add wait_for_images option to screenshot endpoint (#1792)
From PR #1792 by @Br1an67
This commit is contained in:
@@ -73,6 +73,7 @@ class HTMLRequest(BaseModel):
|
||||
class ScreenshotRequest(BaseModel):
|
||||
url: str
|
||||
screenshot_wait_for: Optional[float] = 2
|
||||
wait_for_images: Optional[bool] = False
|
||||
output_path: Optional[str] = None
|
||||
|
||||
class PDFRequest(BaseModel):
|
||||
|
||||
@@ -404,7 +404,7 @@ async def generate_screenshot(
|
||||
validate_url_scheme(body.url)
|
||||
crawler = None
|
||||
try:
|
||||
cfg = CrawlerRunConfig(screenshot=True, screenshot_wait_for=body.screenshot_wait_for)
|
||||
cfg = CrawlerRunConfig(screenshot=True, screenshot_wait_for=body.screenshot_wait_for, wait_for_images=body.wait_for_images)
|
||||
crawler = await get_crawler(get_default_browser_config())
|
||||
results = await crawler.arun(url=body.url, config=cfg)
|
||||
if not results[0].success:
|
||||
|
||||
Reference in New Issue
Block a user