Screenshot Capture🆕

Our Java Script solution now gives you the ability to take a screenshot of the target page through the use of the parameter screenshot=true. This parameter automatically enables JS rendering to get the full page content, before taking a screenshot.

After we serve the response, you can find the screenshot URL in the sa-screenshot response header. The screenshot format is PNG:

  • API REQUEST

require 'net/http'
require 'json'

params = {
  :api_key => "API_KEY",
  :screenshot => "true",
  :url => "https://example.com/"
}

uri = URI('https://api.scraperapi.com/')
uri.query = URI.encode_www_form(params)

response = Net::HTTP.get_response(uri)

puts "Response Headers:"
response.each_header { |key, value| puts "#{key}: #{value}" }

puts "\nResponse Body:"
puts response.body
  • ASYNC REQUEST

require 'net/http'
require 'json'

uri = URI('https://async.scraperapi.com/jobs')

payload = {
  "apiKey" => "API_KEY",
  "url" => "https://example.com",
  "apiParams" => {
    "screenshot" => true
  }
}

json_payload = payload.to_json
response = Net::HTTP.post(uri, json_payload, "Content-Type" => "application/json")
print(response.body)
  • PROXY MODE - COMING SOON!

Last updated

Was this helpful?