Quick Start
Get up and running with Rocket Scraper in minutes. This guide will walk you through making your first API request and understanding the basics of web scraping with our platform.
Prerequisites
- A Rocket Scraper account (sign up here)
- Your API key (find it here)
- A valid subscription plan
- Basic knowledge of HTTP requests
Installation
First, install our SDK for your preferred language:
- Python
- Node.js
pip install rocketscraper
npm install rocketscraper
Making Your First Request
Here's a simple example that scrapes a product title and price from a webpage:
- Python
- Node.js
- Curl
from rocketscraper import RocketClient
try:
client = RocketClient('YOUR_API_KEY')
schema = {
"title": "string",
"price": "number",
"description": "string",
"inStock": "boolean"
}
result = client.scrape('https://example.com/product', schema)
print(result)
except Exception as e:
print(f"Error: {e}")
import { createRocketClient } from 'rocketscraper';
try {
const client = createRocketClient({ apiKey: 'YOUR_API_KEY' });
const schema = {
title: 'string',
price: 'number',
description: 'string',
inStock: 'boolean'
};
const result = await client.scrape({
url: 'https://example.com/product',
schema
});
console.log(result);
} catch (error) {
console.error('Error:', error.message);
}
curl -X POST \
https://api.rocketscraper.com/scrape \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com/product",
"schema": {
"title": "string",
"price": "number",
"description": "string",
"inStock": "boolean"
}
}'
Understanding the Schema
The schema defines the structure of the data you want to extract. Supported data types include:
Type | Description |
---|---|
boolean | Represents a true or false value |
integer | Represents an integer value |
number | Represents any numeric value, including integers and floating-point numbers |
string | Represents a sequence of characters |
array | Represents an ordered list of items |
object | Represents a JSON object, which is a collection of key-value pairs |
Example Response
{
"title": "Premium Coffee Maker",
"price": 99.99,
"description": "Professional-grade coffee maker with temperature control",
"inStock": true
}
Next Steps
- Explore our API Reference for detailed documentation
- Check out our SDK Documentation for language-specific guides
- See Use Cases for practical examples
- Visit our FAQ for common questions