webscraping_ai_selected_multiple
Extract content from multiple CSS selectors on a target URL with configurable options for proxies, JavaScript execution, timeouts, and device emulation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL of the target page. | |
| selectors | Yes | Array of CSS selectors to extract content for. | |
| timeout | No | Maximum web page retrieval time in ms (20000 by default, maximum is 30000). | |
| js | No | Execute on-page JavaScript using a headless browser (false by default). | |
| js_timeout | No | Maximum JavaScript rendering time in ms (3000 by default). | |
| wait_for | No | CSS selector to wait for before returning the page content. | |
| proxy | No | Type of proxy: datacenter, residential, or stealth (datacenter by default). Use residential if the site restricts datacenter traffic, or stealth for the most heavily protected sites with advanced anti-bot detection. Residential and stealth requests cost more than datacenter — see the pricing page. | datacenter |
| country | No | Country of the proxy to use (US by default). | |
| custom_proxy | No | Your own proxy URL in "http://user:password@host:port" format. | |
| device | No | Type of device emulation. | |
| error_on_404 | No | Return error on 404 HTTP status on the target page (false by default). | |
| error_on_redirect | No | Return error on redirect on the target page (false by default). | |
| js_script | No | Custom JavaScript code to execute on the target page. |
Implementation Reference
- src/index.js:331-346 (registration)Registration of the 'webscraping_ai_selected_multiple' tool using server.tool() with URL, selectors, and common options schema.
server.tool( 'webscraping_ai_selected_multiple', { url: z.string().describe('URL of the target page.'), selectors: z.array(z.string()).describe('Array of CSS selectors to extract content for.'), ...commonOptionsSchema }, async ({ url, selectors, ...options }) => { try { const result = await client.selectedMultiple(url, selectors, options); return createSanitizedResponse(JSON.stringify(result, null, 2), url); } catch (error) { return createSanitizedResponse(error.message, url, true); } } ); - src/index.js:333-337 (schema)Input schema for the tool: url (string), selectors (array of strings), and spread commonOptionsSchema.
{ url: z.string().describe('URL of the target page.'), selectors: z.array(z.string()).describe('Array of CSS selectors to extract content for.'), ...commonOptionsSchema }, - src/index.js:338-345 (handler)Handler function that calls client.selectedMultiple(url, selectors, options) and returns sanitized JSON response.
async ({ url, selectors, ...options }) => { try { const result = await client.selectedMultiple(url, selectors, options); return createSanitizedResponse(JSON.stringify(result, null, 2), url); } catch (error) { return createSanitizedResponse(error.message, url, true); } } - src/index.js:112-118 (helper)The selectedMultiple() method on WebScrapingAIClient that sends request to '/selected-multiple' endpoint.
async selectedMultiple(url, selectors, options = {}) { return this.request('/selected-multiple', { url, selectors, ...options }); }