API Documentation
Web Scraping API
Complete reference for the ScrapeBadger Web Scraping API
Getting Started
Install the ScrapeBadger SDK for your preferred language:
pip install scrapebadgerAuthentication
All API requests require an API key. Include it in the Authorization header:
from scrapebadger import ScrapeBadger
client = ScrapeBadger(api_key="your_api_key_here")Scrape
Scrape HTML content from any URL with optional JavaScript rendering:
result = client.scrape(
url="https://example.com",
engine="patchright",
render_js=True
)
print(result.html)
print(result.markdown)Screenshot
Capture screenshots of web pages:
result = client.screenshot(
url="https://example.com",
full_page=True,
format="png"
)
# Save to file
with open("screenshot.png", "wb") as f:
f.write(result.image)AI Extract
Extract structured data using AI:
result = client.extract(
url="https://example.com/product",
schema={
"title": "string",
"price": "number",
"availability": "string"
}
)
print(result.data)
print(f"Quality: {result.quality_score}")Rate Limits
Rate limits vary by tier: Free (60/min), Basic (300/min), Pro (1000/min), Enterprise (5000/min). Check response headers for current limits.