Request JSON Response via Autoparse Parameter in Ruby

Learn to scrape structured JSON data using the autoparse parameter with ScraperAPI in Ruby. Output in JSON or CSV formats is ideal for seamless data integration.

For selected domains we offer a parameter that parses the data and returns structured JSON format. You enable the parsing simply by adding autoparse=true to your request.

Available domains:

Google
Amazon
Walmart
Ebay
Redfin

Search Result

Product Pages

Product Pages

Products Pages

'For Sale' Listings

News Results

Search Results

Category Pages

Search Results

Job Results

Offers

Search Results

Shopping Results

Product Reviews

Google Maps

We recommend using our Structured Data Endpoints instead of the autoparse parameter.

You can find all available endpoints here.

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 

SDK 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

Was this helpful?