Scrape with selectors
About this tool
How to use it
- Choose this tool.
- Type the web address of the page, or paste the page code.
- Type the selector for the part you want, and choose whether to take its text or an attribute such as a link.
- Press Generate.
- Read the result or download it as CSV.
What you get back
Try Scrape with selectors in the Studio
Use it from your code
cURL
curl -X POST "https://app.h2i.davixlabs.io/v1/documents/scrape" \
-H "X-Api-Key: $DAVIX_H2I_API_KEY" \
-F 'url=https://example.com/products' \
-F 'selector=ul.items li a' \
-F 'extract=text'Node.js
const { DavixH2I } = require('@davixlabs/h2i-sdk');
const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.scrape({
"url": "https://example.com/products",
"selector": "ul.items li a",
"extract": "text"
});
console.log(result.data, result.requestId);PHP
<?php
require 'vendor/autoload.php';
$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->scrape([
'url' => 'https://example.com/products',
'selector' => 'ul.items li a',
'extract' => 'text',
]);
echo $result->requestId;