A powerful web scraping API with AI-powered content extraction, session management, and multiple scraping modes (HTTP, JavaScript rendering, and stealthy browser automation).
1curl -X POST https://grazieprego-scrapling.hf.space/api/scrape \
2 -H "Content-Type: application/json" \
3 -d '{
4 "url": "https://example.com",
5 "query": "Extract all product prices",
6 "model_name": "alias-fast"
7 }'
1import requests
2
3# Create session
4session = requests.post(
5 'https://grazieprego-scrapling.hf.space/api/session',
6 json={'model_name': 'alias-fast'}
7)
8session_id = session.json()['session_id']
9
10try:
11 # Multiple scrapes using the same session
12 urls = [
13 'https://example.com/page1',
14 'https://example.com/page2',
15 'https://example.com/page3'
16 ]
17
18 for url in urls:
19 result = requests.post(
20 f'https://grazieprego-scrapling.hf.space/api/session/{session_id}/scrape',
21 json={'url': url, 'query': 'Extract product data'}
22 )
23 print(f"Scraped {url}: {result.json()}")
24finally:
25 # Always close the session
26 requests.delete(f'https://grazieprego-scrapling.hf.space/api/session/{session_id}')
1{
2 "url": "https://example.com",
3 "query": "Extract all headings and prices",
4 "model_name": "alias-fast"
5}
1{
2 "model_name": "alias-fast"
3}
1{
2 "url": "https://example.com",
3 "query": "Extract prices",
4 "response": {
5 "status": 200,
6 "content": ["# Product 1: $19.99", "# Product 2: $29.99"],
7 "url": "https://example.com"
8 }
9}
Built with
Scrapling - Advanced web scraping library