JSON Response - Autoparse

For select websites the API will parse all the valuable data in the HTML response and return it in JSON format. To enable this feature, simply add autoparse=true to your request and the API will parse the data for you. Currently, this feature works with Amazon, Google Search, Google Shopping and Walmart.

  • API REQUEST

require 'net/http'
require 'json'
params = {
:api_key => "APIKEY",
:autoparse => true,
:url => "http://httpbin.org/ip"
}
uri = URI('https://api.scraperapi.com/')
uri.query = URI.encode_www_form(params)
website_content = Net::HTTP.get(uri)
print(website_content)
  • PROXY MODE

require 'httparty'
HTTParty::Basement.default_options.update(verify: false)
response = HTTParty.get('http://httpbin.org/ip', {
  http_proxyaddr: "proxy-server.scraperapi.com",
  http_proxyport: "8001",
  http_proxyuser: "scraperapi.autoparse=true",
  http_proxypass: "APIKEY"
})
results = response.body
puts results 
  • SDM METHOD

# remember to install the library: gem install scraperapi
require "scraper_api"
client = ScraperAPI::Client.new("APIKEY")
result = client.get("http://httpbin.org/ip", autoparse: true).raw_body
puts result

Last updated