Live
Free tier included
Scrape Any Website with CSS Selectors
Extract structured data from any web page using CSS selectors. Get text, HTML, and attributes for every matched element — perfect for lead gen, price monitoring, and research.
CSS Selectors
Text + HTML + Attrs
20 Selectors/Request
No API Key
Interactive Playground
Try it Free
Enter a URL and CSS selectors to extract structured data instantly.
Try Free
Result
Enter a URL and selectors to start scraping
API Documentation
Extract structured data from any web page using CSS selectors. Send a URL and a map of named selectors — get back text, HTML, and attributes for every matched element.
Endpoint
POST
https://www.mahmoudalhabash.com/api/v1/scrape
Send a JSON body with a target URL and a map of named CSS selectors. Each selector returns matched elements with their text content, raw HTML, and attributes.
Request Parameters
Response Fields
status "success" or "error"url The URL that was scrapedhttp_status HTTP status code from the targetdata.{name}.count Number of elements matcheddata.{name}.items[].text Text content of each elementdata.{name}.items[].html Raw HTML of each elementdata.{name}.items[].attributes All HTML attributes as key-value pairstook_ms Total time in millisecondsCode Examples
cURL
curl -X POST https://www.mahmoudalhabash.com/api/v1/scrape \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"selectors": {
"title": "h1",
"links": "a",
"paragraphs": "p"
}
}'
Response 200JSON
{
"status": "success",
"url": "https://example.com",
"http_status": 200,
"data": {
"title": {
"count": 1,
"items": [{
"text": "Example Domain",
"html": "<h1>Example Domain</h1>",
"attributes": {}
}]
},
"links": {
"count": 1,
"items": [{
"text": "More information...",
"attributes": {"href": "https://..."}
}]
}
},
"took_ms": 342
}
JavaScript (fetch)
const res = await fetch('https://www.mahmoudalhabash.com/api/v1/scrape', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
url: 'https://news.ycombinator.com',
selectors: {
titles: '.titleline > a',
scores: '.score'
}
})
});
const { data } = await res.json();
data.titles.items.forEach(item => {
console.log(item.text, item.attributes.href);
});
Python (requests)
import requests
resp = requests.post(
'https://www.mahmoudalhabash.com/api/v1/scrape',
json={
'url': 'https://example.com',
'selectors': {
'heading': 'h1',
'images': 'img'
}
}
)
data = resp.json()['data']
for img in data['images']['items']:
print(img['attributes'].get('src'))
Error Codes
422 Validation failed — URL and selectors are required
429 Rate limit exceeded
500 Failed to fetch target URL or parse HTML
Rate Limits
Unlimited — Free during beta
No API key required. Each request makes a fresh HTTP call. Max 20 selectors per request, 50 items per selector.