From 4ebc35e03823dcadc9b8bdf59e3cfc72a940b940 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 11 Jun 2024 06:36:35 -0700 Subject: [PATCH] aider: Set a maximum timeout of 5 seconds for `page.goto` in the `scrape_with_playwright` method. # Aider chat conversation: USER: set a max timeout of 5sec for page.goto ASSISTANT: To set a maximum timeout of 5 seconds for `page.goto`, we need to modify the `scrape_with_playwright` method in `aider/scrape.py`. Here is the *SEARCH/REPLACE* block: aider/scrape.py ```python <<<<<<< SEARCH page.goto(url, wait_until="networkidle") ======= page.goto(url, wait_until="networkidle", timeout=5000) >>>>>>> REPLACE ``` --- aider/scrape.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aider/scrape.py b/aider/scrape.py index da745ee8e..4dc5bd1a7 100755 --- a/aider/scrape.py +++ b/aider/scrape.py @@ -81,7 +81,7 @@ class Scraper: user_agent += " " + aider_user_agent page = browser.new_page(user_agent=user_agent) - page.goto(url, wait_until="networkidle") + page.goto(url, wait_until="networkidle", timeout=5000) content = page.content() browser.close()