Official Ruby SDK for Capture - Screenshot and content extraction API.
Add to your Gemfile:
gem "capture_page"Or install directly:
gem install capture_pagerequire "capture"
client = Capture.new("your-api-key", "your-api-secret")
image_url = client.build_image_url("https://example.com")
puts image_url- Screenshot Capture: Capture full-page or viewport screenshots as PNG/JPG
- PDF Generation: Convert web pages to PDF documents
- Content Extraction: Extract HTML and text content from web pages
- Metadata Extraction: Get page metadata (title, description, og tags, etc.)
- Animated GIFs: Create animated GIFs of page interactions
- Zero Dependencies: Uses only Ruby standard library
require "capture"
client = Capture.new("your-api-key", "your-api-secret")
# Use edge endpoint for faster response times
client = Capture.new("your-api-key", "your-api-secret", use_edge: true)image_url = client.build_image_url("https://example.com")
image_url = client.build_image_url("https://example.com", {
"full" => true,
"delay" => 2,
"vw" => 1920,
"vh" => 1080
})pdf_url = client.build_pdf_url("https://example.com")
pdf_url = client.build_pdf_url("https://example.com", {
"format" => "A4",
"landscape" => true
})content_url = client.build_content_url("https://example.com")metadata_url = client.build_metadata_url("https://example.com")animated_url = client.build_animated_url("https://example.com")image_data = client.fetch_image("https://example.com")
File.binwrite("screenshot.png", image_data)pdf_data = client.fetch_pdf("https://example.com", { "full" => true })
File.binwrite("page.pdf", pdf_data)content = client.fetch_content("https://example.com")
puts content["html"]
puts content["textContent"]
puts content["markdown"]metadata = client.fetch_metadata("https://example.com")
puts metadata["metadata"]gif_data = client.fetch_animated("https://example.com")
File.binwrite("animation.gif", gif_data)use_edge(boolean): Use edge.capture.page instead of cdn.capture.page for faster response times
The SDK supports two base URLs:
- CDN:
https://cdn.capture.page(default) - Edge:
https://edge.capture.page(whenuse_edge: true)
MIT
For support, please visit capture.page or open an issue on GitHub.