Official Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.
Python aiai-agentscrawl4ai-cloudcrawlerdata-extractionllmmarkdownmcpopen-sourceplaywrightpythonragscraperweb-crawlerweb-crawlingweb-scraping
fix(docker): apply base_config to the crawler_configs list on the streaming path
Talel Boussetta974275d0675c
diff --git a/deploy/docker/api.py b/deploy/docker/api.pyindex d9ce3ade..244b5046 100644--- a/deploy/docker/api.py+++ b/deploy/docker/api.py@@ -989,7 +989,9 @@ async def handle_stream_crawl_request(clamp_deep_crawl(crawler_config)crawler_config.stream = Trueconfig_list = (- _load_crawler_configs(crawler_configs, stream=True)+ _load_crawler_configs(+ crawler_configs, config["crawler"]["base_config"], stream=True+ )if crawler_configselse None)diff --git a/deploy/docker/tests/test_crawler_configs_routing.py b/deploy/docker/tests/test_crawler_configs_routing.pyindex 65303b3d..9f5336cf 100644--- a/deploy/docker/tests/test_crawler_configs_routing.py+++ b/deploy/docker/tests/test_crawler_configs_routing.py@@ -116,6 +116,46 @@ def test_stream_passes_the_config_list(server_module, monkeypatch):assert all(c.stream for c in config)[email protected]("stream", [False, True])+def test_base_config_fills_the_list_on_both_paths(server_module, monkeypatch, stream):+ """/crawl and /crawl/stream give the list the same server defaults."""+ crawler = RecordingCrawler()+ api = _install(monkeypatch, crawler)+ config = {+ **server_module.config,+ "crawler": {+ **server_module.config["crawler"],+ "base_config": {"css_selector": "main"},+ },+ }+ handler = api.handle_stream_crawl_request if stream else api.handle_crawl_request++ asyncio.run(+ handler(+ urls=["https://example.com/", "https://example.org/"],+ browser_config={},+ crawler_config={},+ config=config,+ crawler_configs=[+ {+ "type": "CrawlerRunConfig",+ "params": {"url_matcher": "*example.com*"},+ },+ {+ "type": "CrawlerRunConfig",+ "params": {"url_matcher": "*", "css_selector": "#own"},+ },+ ],+ )+ )++ [(method, urls, configs)] = crawler.calls+ assert method == "arun_many"+ # An entry that leaves the field unset gets base_config's value; one that+ # sets it keeps its own.+ assert [c.css_selector for c in configs] == ["main", "#own"]++def test_stream_endpoint_forwards_the_list(server_module, monkeypatch):captured = {}