Web Scraping API vs Playwright: Which Should You Use?
TL;DR
Use a web scraping API when you need consistent page content or artifacts from known URLs and the request options can reach the target state.
Use Playwright when the task depends on actions or assertions across several browser states.
Nstdata Crawl supplies page evidence through the API or MCP. Nstdata Cloud Browser supplies a managed browser session that a compatible Playwright client can control.
Separate product discovery from collection. Use a search tool, search API, or catalog when the input is a product name.
Compare approaches by accepted fields, valid interactions, reproducibility, and end-to-end cost under the same scoped task.
A product page may update its offer after you select a variant. Which integration should you use to record it? The answer depends on whether the selected offer can be retrieved from a URL and documented request options, or whether your code needs to inspect a live session between actions. The distinction affects how you test the result, operate the workflow, and recover from failures.
What Is a Web Scraping API?
A web scraping API accepts a target and collection options, retrieves the page, and returns content or artifacts your application can process. Providers differ in rendering, supported actions, result schemas, and task controls. Nstdata Crawl
How request-oriented collection works
A collector sends a known URL and the required output, waits for the result or checks an asynchronous task, and validates the returned evidence. Formats such as Markdown and HTML suit text review or markup-based extraction. For a dynamic offer, request rendering and verify the selected model and currency before accepting a value.
Where scraping APIs fit
Use them for approved product-page retrieval, catalog checks, web research, or pipelines that appraise and store records from many URLs. Your workflow can keep discovery, retrieval, extraction, and validation in separate stages. If a collection returns partial content, retry or route to review instead of assuming price or stock. Bulk crawling workflow
Nstdata Crawl is a Web Crawling API for LLM-ready data. Developers can call it with an API client or SDK, and a compatible AI assistant can access it through Local or Remote MCP. These are access paths to the same product. The assistant uses connected search or a catalog to discover pages, then invokes Crawl on approved URLs and analyzes the evidence. Nstdata MCP Server documentation
What Is Playwright?
Playwright is a browser automation library that enables an application to navigate pages, perform actions, check states, and capture content or images.
How Playwright controls a browser
A script selects a browser context and page, locates elements, performs actions, and asserts the state that matters. For a product page, verify the title and apply a color selection only if the page exposes a legitimate control. Wait until the selected option and the price display correspond to one offer. Verify visibility or other actionability conditions before proceeding. Playwright actionability and waiting
Why dynamic actions need explicit checks
Navigation completion and offer readiness are different events. A variant selection might update a separate part of the page or trigger a later result. Test the selected variant plus the updated offer. If required consent, authentication, or access conditions prevent the authorized task, record the result and use an approved path.
Local and hosted browser options
Run Playwright locally when you need direct control of the runtime and the team can manage the browser. Use Nstdata Cloud Browser for managed browser sessions with a documented remote connection. Confirm the required browser and attachment protocol. Playwright documents that CDP attachment is Chromium-based and offers lower fidelity than its own protocol connection. Check whether your workflow relies on features that behave differently after attachment. Playwright browser connection methods
How Do a Web Scraping API and Playwright Differ?
A web scraping API lets you request a returned artifact or page result. Playwright lets you drive and inspect an active browser. Some APIs render JavaScript or accept a supported action sequence, so the test is whether the available controls are sufficient for the exact workflow.
Dimension
Web scraping API
Playwright
Input and output
URL plus options, with content or artifacts defined by the service.
Browser actions and assertions, with output from your script.
Dynamic content
Use supported rendering and request actions. Verify the selected result.
Inspect intermediate states, branch, and assert the exact state.
Developer setup
API credentials, client, result handling, and validation.
Runtime, locators, contexts, diagnostics, and cleanup.
Operations
Match task limits, retry rules, and result retrieval to the application's input.
Manage or lease browser sessions and budget for open runtime.
AI agent access
Supported MCP tools can expose collection to an assistant.
Browser controls need a separately integrated automation tool or application.
Evidence
Source content or documented artifacts returned by the service.
Text, screenshots, and other evidence the script chooses to save.
Compare maintenance and cost by outcome
Include the labor to diagnose changed markup or a failed wait. An API may create less runtime work for standard page retrieval. Playwright can reduce ambiguity when an offer depends on a state you can directly verify. For hosted browsers, include session start, time spent idle, and cleanup. Compare cost per accepted record and hours needed for ongoing maintenance.
For large workloads, keep per-source budgets and a fallback policy. A page at the wrong variant remains a failed acceptance even when the HTTP request or browser action succeeds. Review field and state test coverage before increasing throughput. Playwright and managed scraping approaches
How Do You Compare Crawl MCP, the Crawl API, and Playwright on the Same Task?
Use one approved product URL and one acceptance rule for all collection paths. To start from βSony WH-1000XM5 Blackβ, find candidate listings with a search tool or catalog. Confirm the exact model, color, condition, seller, and market before choosing the URL. Then ask each method to return one-time price, currency, availability, matched product, source URL and observation time. Track URL discovery as its own stage.
Nstdata Crawl is a Web Crawling API for LLM-ready data. Its six MCP output values serve different jobs. markdown gives an analyst or model readable offer evidence and html retains markup for selector-based extraction. links helps discover candidate pages. screenshot and pdf preserve visual evidence, and rawData retains a raw artifact for inspection. The workflow still owns product matching, price validation and calendar history. Nstdata Crawl product and outputs
Method 1 β Connect an AI assistant through Crawl MCP
Step 1 β Register the connection. For Local MCP, use Node.js 22.18 or later within the 22.x series, or 24.x, with npx on the client's PATH. Add a stdio server to the MCP client and keep your Crawl key in its protected configuration. Merge the following for a client that supports the mcpServers JSON format.
For Hosted Crawl MCP, add https://mcp.nstdata.io/crawl over Streamable HTTP. Start authorization in your client. Leave custom headers and the bearer-token field empty for OAuth, then authorize with your Nstdata API key. A client with static headers can use X-API-Key as its sole authentication method. The hosted route needs no local Node runtime. Enable one Crawl connection per session and confirm the six tools appear before submitting a collecting task. Official MCP installation and hosted authentication
Step 2 β Submit the known product URL. For the ordinary capture, start with Markdown and request HTML in a separate diagnostic when markup matters. This documented example submits one approved Sony US product URL. For a dynamic page, add options.jsRender.waitForSelector with a selector that you have verified on the target, or set a documented timed wait. Crawl also supports bounded actions within a request. For a country-specific test, set options.proxy.country to the needed two-letter code. Crawl manages the connection for the request. Keep your independent egress evidence and the actual returned storefront separate. Tool options and scope
Step 3 β Read and validate the result. Read data.markdown after a completed, successful task. When you receive data.markdownRef, read it with nstdata_crawl_read_result. Pass the actual opaque value as ref with format: "markdown" and offset: 0, then advance with the actual nextOffset. For an asynchronous submission, call nstdata_crawl_scrape_result with the returned ID as taskId. Use a bounded poll budget. In the summary, cite the line supporting the offer and preserve unavailable fields as unknown.
To discover approved product URLs inside a retailer's category, start from its category page with nstdata_crawl_start. Set explicit maxPages, maxDepth and any applicable path filters. Read overall status with nstdata_crawl_status, then inspect actual page outcomes with nstdata_crawl_pages before promoting a link to the watchlist. A category crawl can finish with individual pages still failed or missing.
Method 2 β Call the Crawl API from Python
Step 1 β Install the SDK. In Python 3.10 or later, run python -m pip install nstdata-ai-crawl==1.0.1. Supply the Crawl API key through NSTDATA_API_TOKEN at runtime. The SDK is a separate integration path for a service that owns scheduling and validation.
Step 2 β Save and read one response. Save the following as collect_offer.py and pass the approved product URL as the only argument. Read referenced content within the open SDK client. Capture the task ID and file when content is complete. Send rejected results to review before updating downstream prices. This is a documented direct API example. Use an authorized Crawl account with available credits when running it.
import os
import sys
from pathlib import Path
from nstdata_ai_crawl import NstDataApiError, NstDataClient, ScrapeRequestDto
try:with NstDataClient(os.environ["NSTDATA_API_TOKEN"], max_response_bytes=2_000_000)as client: result = client.submit_scrape_task_sync(ScrapeRequestDto( url=sys.argv[1], formats=["markdown"], timeout=25000,))if result.status !="completed"or result.success isnotTrueor result.data isNone:raise SystemExit(f"Crawl task needs review: {result.status}")if result.data.truncated isTrue:raise SystemExit("Crawl returned a truncated result") markdown = result.data.get_markdown()ifnot markdown:raise SystemExit("Crawl returned no Markdown") Path("offer.md").write_text(markdown, encoding="utf-8")print(f"Saved offer.md (task: {result.id})")except NstDataApiError as error:raise SystemExit(f"Crawl failed: {error.kind}")fromNone
Step 3 β Validate the extracted offer. Look for the matching variant and seller in offer.md before accepting any field. Save the task ID, observation time, and validated fields in your own storage. A separate direct HTTP probe in the accompanying pilot received 403. The pilot verified the Local MCP collection path. Crawl SDK and task reference Β· Official Crawl MCP client and tool guide
Method 3 β Assert the offer change with Playwright
Step 1 β Install a browser runtime. The compact JavaScript example uses the Playwright package playwright-core with Chromium. Run npm install playwright-core@1.65.1 and npx playwright-core install chromium in an empty project folder.
Step 2 β Run the state test. Save the following as offer.mjs and run node offer.mjs. The local fixture sets the page directly, starts with no selected offer, and sets the Black price after a button click. The price in the fixture is synthetic. It demonstrates waiting for an observed state change without sending an external request.
An offline Chromium run printed Black | USD 249.00 | In stock after the click and the two state checks passed.
Step 3 β Apply the acceptance rule to your own page. Replace the fixture with a permitted URL and use the real variant and price markers. Assert both the selected variant and its visible offer after the action. If the workflow needs a remote browser, use Nstdata Cloud Browser's session lifecycle to create a session and attach over supported Chromium CDP. Wait until the session reports ready. Attach with chromium.connectOverCDP(cdpUrl, { headers }) using the issued short-lived credentials, then verify the browser context and page before saving evidence. Disconnect Playwright, stop the session by its ID, and verify it reaches ended. Test this lifecycle separately from local execution.
What did the shared evidence actually show?
The November 23, 2026 Local Crawl MCP pilot accepted six observations across three listings. Sony US displayed USD 399.99 and an availability notification, B&H showed USD 398.00 and stock, and John Lewis in the UK showed GBP 199.00 and online stock. Each listing had two separate observations. The real snapshots support page extraction under known settings. The local browser example instead defines an interaction test with a known expected state. A live three-way retailer benchmark and comparable cost figures require running all three paths on the same URL and time window.
Outcome to compare
Evidence to save
Baseline retrieval
For all methods, save the same variant, currency, visible price, stock, URL, and UTC observation time.
Interaction readiness
Record the initial and final selected states. Mark a route that cannot represent the required action as inapplicable.
Incomplete or wrong result
Separate access denial, task failure, missing evidence and incorrect selection. Keep the last valid record with its original time.
Operating cost
Compare validated rows per billing window. Include collection and browser time, evidence reads, and review.
When Should You Use a Web Scraping API?
Use a web scraping API when the required evidence can be described as retrieving an accepted URL with documented settings. It supports repeated page collection for product monitoring, document ingestion, or AI research. Developers can keep extraction and storage in their application. Analysts can use compatible MCP tools to read reviewed sources and produce a report. Structured product data extraction
Check task status and output completeness before treating the result as a valid product row. Use the simplest response format that preserves the required evidence. If the selected retailer exposes a clear static price, HTML or Markdown can be enough. If a page loads the offer after navigation, enable supported rendering and assert that the response contains comparable data.
When Should You Use Playwright?
Use Playwright when the result depends on selecting a product variant, following a multi-step flow, inspecting a state between actions, or capturing an image at a precisely defined point.
Develop a small script with clear assertions and failure stages. Choose selectors that identify actual controls or states, especially when text and pricing appear repeatedly. Record the variant, marketplace seller, and fulfillment context before extracting the price. Preserve a screenshot when someone needs visual proof of what changed. A script that pastes the same timeout into each step loses useful evidence about what actually failed.
Use a hosted browser for cases that require a remote runtime or documented regional environment. Keep jobs bounded and close sessions reliably. If you also use a proxy, verify the actual browser and storefront configuration. Playwright and a managed session give you controls you can validate rather than a guarantee that every target will return the expected content.
Can You Combine Nstdata Crawl and Playwright?
Use Nstdata Crawl for routine content retrieval and reserve Playwright with Nstdata Cloud Browser for approved cases requiring stateful interaction. Send the result of each route through the same schema validator.
Keep distinct triggers for rendering needed, stateful action needed, access denied, and product mismatch. A renderer or alternate route can only help when the problem it addresses is compatible with the approved task. If the offer requires selecting a delivery region, pass the verified listing and expected state to a browser worker. When that worker returns data, retain its own timestamp, region, and evidence. Merge records only when the offer context remains comparable.
An external scheduler or queue can assign work to the appropriate route. Include the initial attempt and any follow-up in cost and coverage reports. This makes it possible to see whether the interactive fallback improves accepted results enough to justify the additional maintenance.
Which Approach Should You Choose for Your Workflow?
Choose Nstdata Crawl for URL-based content and artifacts when the documented actions or rendering suffice. Choose Playwright when you must control the browser between steps, and add Nstdata Cloud Browser if you need a hosted session. Combine them when your workload contains both ordinary page collection and a smaller number of legitimate interactive cases.
Start with one product and an acceptance rule. Compare the evidence each approach returns and how it reports an incomplete result. Use the route that gets you a verified answer with a lifecycle your team can maintain.
What Else Should You Check Before Choosing an Integration?
Check the exact retrieval options, observable browser state, and session lifecycle against your acceptance rule.
Q: Can a scraping API render JavaScript?
Some APIs, including Nstdata Crawl, document browser rendering. Verify that the documented options can expose the required state and capture the evidence you need.
Q: Does using Crawl MCP give an AI assistant a continuous browser session?
Crawl MCP provides page collection tools. Use a supported Playwright integration and browser session for continuous browser control.
Q: Can Playwright start from a product name?
Pair Playwright with a search tool or catalog. Playwright navigates or interacts with the discovered URL after your application validates it.
Q: Which tool is better for screenshots?
Use request-based capture when its controls cover the desired state. Use Playwright when the image depends on scripted interactions and assertions inside a browser session.
Q: Can I move the same Playwright script to any hosted provider?
Check the browser engine, connection protocol, supported options, and session cleanup behavior. Verify the script in the exact hosted environment you plan to use.
Lena Zhou
Nov. 24th 2026
110M+ real IPs with 99.9% access success
Blazing-fast average response ~0.5s for high-concurrency tasks
From only $0.1/GB
Get immediate access to premium residential, datacenter, IPv6 and ISP proxy pools.