crawl4ai icon indicating copy to clipboard operation
crawl4ai copied to clipboard

crawler_strategy.set_hook() is not working

Open studio-anurag opened this issue 1 year ago • 0 comments

@unclecode I see that setting hook is not working as expected. I am setting a delay using code below :

def delay(driver):
        print("Delaying for 5 seconds...")
        time.sleep(5)
        print("Resuming...")

crawler_strategy = LocalSeleniumCrawlerStrategy(verbose=True)
crawler_strategy.set_hook('after_get_url', delay)
print("Hook Created and attached to crawler strategy")
crawler = WebCrawler(verbose = True, crawler_strategy=crawler_strategy)
print("Hook Set to crawler")

Neither print statements are working nor the delay function is executed. The web page is being crawled without the given delay. Any idea?

studio-anurag avatar Oct 01 '24 13:10 studio-anurag