webscraping_ai_selected_multiple
Extract content from multiple CSS selectors on a web page. Provide a URL and an array of selectors to retrieve targeted data.
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 or residential (datacenter by default). | 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)Tool 'webscraping_ai_selected_multiple' is registered via server.tool() with a Zod schema (url + selectors array) and a handler that calls client.selectedMultiple().
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:338-345 (handler)The handler function for 'webscraping_ai_selected_multiple' - destructures url, selectors, and options, calls client.selectedMultiple(url, selectors, options), and wraps the result through createSanitizedResponse().
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 client.selectedMultiple() method on WebScrapingAIClient - makes a GET request to '/selected-multiple' endpoint passing url, selectors (array of CSS selectors), and additional options.
async selectedMultiple(url, selectors, options = {}) { return this.request('/selected-multiple', { url, selectors, ...options }); } - src/index.js:333-336 (schema)Input schema for the tool: 'url' (string) and 'selectors' (array of strings) plus common options spread from 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