request
, fetch
, stream
, or pipeline
API methods based on your specific use case requirements.undici
package using npm:
request
method to call ZenRows’ Universal Scraper API:
js_render: "true"
: Activates JavaScript execution to handle dynamic content and render the page completelypremium_proxy: "true"
: Routes requests through high-quality residential IP addresses to avoid detectionThese parameters work together to bypass sophisticated antibots. For a comprehensive list of all available parameters and their usage, check the parameter overview table.YOUR_ZENROWS_API_KEY
with your actual API key and run the script:
css_extractor
parameter to get structured data:
X-Request-Id
from your response headers to help us diagnose issues quickly.
How do I handle websites that block my Undici requests?
js_render
and premium_proxy
parameters in your ZenRows API calls. This combination offers the highest success rate against sophisticated antibot protection by simulating real browser behavior and utilizing high-quality residential IP addresses.How do I handle JavaScript-heavy websites with Undici and ZenRows?
js_render
parameter in your ZenRows API calls. This uses a real browser to execute JavaScript and capture the fully rendered page. Combine with Undici’s efficient request handling for optimal performance on modern web applications.Can I use Undici's streaming capabilities with ZenRows?
stream()
and pipeline()
methods work perfectly with ZenRows. This is especially useful for processing large responses efficiently without loading everything into memory.What's the difference between undici.request() and undici.fetch() with ZenRows?
undici.request()
provides better performance and more control over the request/response lifecycle, while undici.fetch()
offers a more familiar API similar to browser fetch. For maximum performance with ZenRows, use undici.request()
.How do I extract specific data from pages using Undici and ZenRows?
css_extractor
parameter in your ZenRows API calls to extract content using CSS selectors directly. The response will be JSON instead of HTML, making it easier to process with Undici.Can I use Undici with ZenRows for real-time monitoring?
session_id
parameter and implement efficient polling with Undici’s connection pooling.Does Undici work with ZenRows' advanced features like screenshots and PDF outputs?