Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat(interact): return cdpUrl in the scrape interact response (#3806)
Gergő Móricz1f00cc788ee7
diff --git a/apps/api/src/__tests__/snips/v2/scrape-browser.test.ts b/apps/api/src/__tests__/snips/v2/scrape-browser.test.tsindex 3adc806a0..1ad307b56 100644--- a/apps/api/src/__tests__/snips/v2/scrape-browser.test.ts+++ b/apps/api/src/__tests__/snips/v2/scrape-browser.test.ts@@ -107,6 +107,8 @@ describe("Scrape browser interact replay", () => {expect(executeResponse.statusCode).toBe(200);expect(executeResponse.body.success).toBe(true);expect(executeResponse.body.stdout).toContain(marker);+ expect(typeof executeResponse.body.cdpUrl).toBe("string");+ expect(executeResponse.body.cdpUrl.length).toBeGreaterThan(0);} finally {if (scrapeId) {await scrapeStopInteractiveBrowserRaw(scrapeId, identity);diff --git a/apps/api/src/controllers/v2/scrape-browser.ts b/apps/api/src/controllers/v2/scrape-browser.tsindex c54cbc110..4decfde35 100644--- a/apps/api/src/controllers/v2/scrape-browser.ts+++ b/apps/api/src/controllers/v2/scrape-browser.ts@@ -99,6 +99,7 @@ type BrowserExecuteRequest = z.infer<typeof browserExecuteRequestSchema>;interface BrowserExecuteResponse {success: boolean;+ cdpUrl?: string;liveViewUrl?: string;interactiveLiveViewUrl?: string;output?: string;@@ -361,6 +362,7 @@ export async function scrapeInteractController(return res.status(200).json({success: !hasError,+ cdpUrl: session.cdp_url,liveViewUrl: session.cdp_path,interactiveLiveViewUrl: session.cdp_interactive_path,...(agentOutput ? { output: agentOutput } : {}),diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.jsonindex 26eb9c64f..9c4b50d99 100644--- a/apps/js-sdk/firecrawl/package.json+++ b/apps/js-sdk/firecrawl/package.json@@ -1,6 +1,6 @@{"name": "@mendable/firecrawl-js",- "version": "4.27.0",+ "version": "4.28.0","description": "JavaScript SDK for Firecrawl API","main": "dist/index.js","types": "dist/index.d.ts",diff --git a/apps/js-sdk/firecrawl/src/__tests__/unit/v2/scrape-browser.unit.test.ts b/apps/js-sdk/firecrawl/src/__tests__/unit/v2/scrape-browser.unit.test.tsindex edf6ad832..fe8e30b61 100644--- a/apps/js-sdk/firecrawl/src/__tests__/unit/v2/scrape-browser.unit.test.ts+++ b/apps/js-sdk/firecrawl/src/__tests__/unit/v2/scrape-browser.unit.test.ts@@ -33,6 +33,7 @@ describe("JS SDK v2 scrape-browser methods", () => {data: {success: true,output: "Clicked the button",+ cdpUrl: "wss://browser.example.com/cdp",liveViewUrl: "https://live.example.com/view",interactiveLiveViewUrl: "https://live.example.com/interactive",stdout: "",@@ -52,6 +53,7 @@ describe("JS SDK v2 scrape-browser methods", () => {);expect(response.success).toBe(true);expect(response.output).toBe("Clicked the button");+ expect(response.cdpUrl).toBe("wss://browser.example.com/cdp");expect(response.liveViewUrl).toBe("https://live.example.com/view");expect(response.interactiveLiveViewUrl).toBe("https://live.example.com/interactive",diff --git a/apps/js-sdk/firecrawl/src/v2/types.ts b/apps/js-sdk/firecrawl/src/v2/types.tsindex d617335dd..175486687 100644--- a/apps/js-sdk/firecrawl/src/v2/types.ts+++ b/apps/js-sdk/firecrawl/src/v2/types.ts@@ -1115,6 +1115,7 @@ export interface BrowserCreateResponse {export interface BrowserExecuteResponse {success: boolean;+ cdpUrl?: string;liveViewUrl?: string;interactiveLiveViewUrl?: string;output?: string;diff --git a/apps/python-sdk/firecrawl/__init__.py b/apps/python-sdk/firecrawl/__init__.pyindex a0e20204e..9db7941a2 100644--- a/apps/python-sdk/firecrawl/__init__.py+++ b/apps/python-sdk/firecrawl/__init__.py@@ -17,7 +17,7 @@ from .v1 import (V1ChangeTrackingOptions,)-__version__ = "4.29.0"+__version__ = "4.30.0"# Define the logger for the Firecrawl projectlogger: logging.Logger = logging.getLogger("firecrawl")diff --git a/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/aio/test_aio_scrape_request_preparation.py b/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/aio/test_aio_scrape_request_preparation.pyindex 603ea8f8c..dfc5aa224 100644--- a/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/aio/test_aio_scrape_request_preparation.py+++ b/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/aio/test_aio_scrape_request_preparation.py@@ -127,6 +127,7 @@ class TestAsyncScrapeRequestPreparation:{"success": True,"output": "Clicked the button",+ "cdpUrl": "wss://browser.example.com/cdp","liveViewUrl": "https://live.example.com/view","interactiveLiveViewUrl": "https://live.example.com/interactive","stdout": "",@@ -148,6 +149,7 @@ class TestAsyncScrapeRequestPreparation:}assert response.success is Trueassert response.output == "Clicked the button"+ assert response.cdp_url == "wss://browser.example.com/cdp"assert response.live_view_url == "https://live.example.com/view"assert response.interactive_live_view_url == "https://live.example.com/interactive"diff --git a/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_scrape_request_preparation.py b/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_scrape_request_preparation.pyindex a4b4d4867..ee30e83b2 100644--- a/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_scrape_request_preparation.py+++ b/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_scrape_request_preparation.py@@ -179,6 +179,7 @@ class TestScrapeRequestPreparation:{"success": True,"output": "Clicked the button",+ "cdpUrl": "wss://browser.example.com/cdp","liveViewUrl": "https://live.example.com/view","interactiveLiveViewUrl": "https://live.example.com/interactive","stdout": "",@@ -200,6 +201,7 @@ class TestScrapeRequestPreparation:}assert response.success is Trueassert response.output == "Clicked the button"+ assert response.cdp_url == "wss://browser.example.com/cdp"assert response.live_view_url == "https://live.example.com/view"assert response.interactive_live_view_url == "https://live.example.com/interactive"diff --git a/apps/python-sdk/firecrawl/v2/methods/aio/scrape.py b/apps/python-sdk/firecrawl/v2/methods/aio/scrape.pyindex df1065a93..a7ecf3fcb 100644--- a/apps/python-sdk/firecrawl/v2/methods/aio/scrape.py+++ b/apps/python-sdk/firecrawl/v2/methods/aio/scrape.py@@ -77,6 +77,8 @@ async def interact(normalized = dict(body)if "exitCode" in normalized and "exit_code" not in normalized:normalized["exit_code"] = normalized["exitCode"]+ if "cdpUrl" in normalized and "cdp_url" not in normalized:+ normalized["cdp_url"] = normalized["cdpUrl"]if "liveViewUrl" in normalized and "live_view_url" not in normalized:normalized["live_view_url"] = normalized["liveViewUrl"]if "interactiveLiveViewUrl" in normalized and "interactive_live_view_url" not in normalized:diff --git a/apps/python-sdk/firecrawl/v2/methods/scrape.py b/apps/python-sdk/firecrawl/v2/methods/scrape.pyindex 073a41890..b0dec7e06 100644--- a/apps/python-sdk/firecrawl/v2/methods/scrape.py+++ b/apps/python-sdk/firecrawl/v2/methods/scrape.py@@ -128,6 +128,8 @@ def interact(normalized = dict(payload)if "exitCode" in normalized and "exit_code" not in normalized:normalized["exit_code"] = normalized["exitCode"]+ if "cdpUrl" in normalized and "cdp_url" not in normalized:+ normalized["cdp_url"] = normalized["cdpUrl"]if "liveViewUrl" in normalized and "live_view_url" not in normalized:normalized["live_view_url"] = normalized["liveViewUrl"]if "interactiveLiveViewUrl" in normalized and "interactive_live_view_url" not in normalized:diff --git a/apps/python-sdk/firecrawl/v2/types.py b/apps/python-sdk/firecrawl/v2/types.pyindex 2bdbb0dfe..55b24b297 100644--- a/apps/python-sdk/firecrawl/v2/types.py+++ b/apps/python-sdk/firecrawl/v2/types.py@@ -1158,6 +1158,7 @@ class BrowserExecuteResponse(BaseModel):"""Response from executing code in a browser session."""success: bool+ cdp_url: Optional[str] = Nonelive_view_url: Optional[str] = Noneinteractive_live_view_url: Optional[str] = Noneoutput: Optional[str] = None