Google SERP API
This endpoint will retrieve product data from an Google search result page and transform it into usable JSON.
require 'net/http'
require 'json'
params = {
:api_key => "APIKEY",
:query => "QUERY",
:country_code => "COUNTRY_CODE",
:tld => "TLD"
}
uri = URI('https://api.scraperapi.com/structured/google/search')
uri.query = URI.encode_www_form(params)
website_content = Net::HTTP.get(uri)
print(website_content)
The Google Structured Data endpoint supports several parameters:
Google parameters supported by this endpoint
Sample Response
{
"search_information": {
"query_displayed": "earth diameter",
"total_results": 2,
"time_taken_displayed": 1890000
},
"organic_results": [
{
"position": 0,
"title": "What is the Diameter of Earth?",
"tags": "Jun 14, 2008 —",
"snippet": "Jun 14, 2008 — As a result, the latest measurements indicate that the Earth has an equatorial diameter of 12,756 km (7926 mi), and a polar diameter of 12713.6 ...",
"highlighs": [
"equatorial diameter of 12,756 km (7926 mi"
],
"link": "https://www.universetoday.com/15055/diameter-of-earth/",
"displayed_link": "https://www.universetoday.com › diameter-of-earth"
},
{
"position": 1,
"title": "What is the diameter of Earth? Teaching Wiki",
"snippet": "This gives us a mean diameter of 12,742 km or 7917.5 miles. How was the diameter of Earth first measured? The diameter of Earth was first calculated by ...",
"highlighs": [
"12,742 km or 7917.5 miles"
],
"link": "https://www.twinkl.com/teaching-wiki/diameter-of-earth",
"displayed_link": "https://www.twinkl.com › teaching-wiki › diameter-of..."
},
{
"position": 2,
"title": "Earth radius",
"snippet": "Earth's diameter is simply twice Earth's radius; for example, equatorial diameter (2a) and polar diameter (2b). For the WGS84 ellipsoid, that's respectively ...Earth dimensionsEdit ; Equatorial diameter, 12,756.3 km (7,926.4 mi) ; Polar diameter, 12,714 km (7,900 mi) ; Polar radius, 6,356.89 km (3,949.99 mi) ; Volume of ...",
"highlighs": [
"diameter is simply twice Earth's radius",
"12,756.3 km (7,926.4 mi"
],
"link": "https://en.wikipedia.org/wiki/Earth_radius",
"displayed_link": "https://en.wikipedia.org › wiki › Earth_radiushttps://en.wikipedia.org › wiki › Earth_physical_chara...",
"sitelinks": {
"inline": [
{
"title": "Earth physical characteristics tableshttps://en.wikipedia.org › wiki › Earth_physical_chara...",
"link": "https://en.wikipedia.org/wiki/Earth_physical_characteristics_tables"
}
]
}
},
{
"position": 3,
"title": "How did mankind first determine the size of the Earth?",
"snippet": "The circumference of the Earth is just its average diameter, 7915 miles, times the number pi, where pi is 3.14159. This gives us about 25,000 miles for the ...",
"highlighs": [
"7915 miles"
],
"link": "https://www.uu.edu/dept/physics/scienceguys/2001July.cfm",
"displayed_link": "https://www.uu.edu › dept › physics › scienceguys"
},
{
"position": 4,
"title": "How was the size of Earth first measured?",
"snippet": "Earth's circumference was first accurately measured more than 2000 years ago by the Greek astronomer Eratosthenes, who at the time lived in the Egyptian ...",
"highlighs": [
"circumference was first accurately measured more than 2000 years ago by"
],
"link": "https://stardate.org/astro-guide/faqs/how-was-size-earth-first-measured",
"displayed_link": "https://stardate.org › astro-guide › faqs › how-was-size..."
},
{
"position": 5,
"title": "Essential Facts You Need to Know About Planet Earth",
"tags": "Jan 15, 2019 —",
"snippet": "Jan 15, 2019 — The Earth's diameter at the equator is 7,926.28 miles, and its diameter at the poles is 7,899.80 miles. Rotation on Axis. It takes the Earth 23 ...",
"highlighs": [
"at the equator is 7,926.28 miles"
],
"link": "https://www.thoughtco.com/essential-facts-about-the-planet-earth-1435092",
"displayed_link": "https://www.thoughtco.com › Geography › Basics"
},
{
"position": 6,
"title": "Measuring Earth's diameter – ASI POEC",
"snippet": "Measuring Earth's diameter. The aim of this activity is to get amateur astronomers, teachers and students to estimate the circumference of the Earth using ...",
"highlighs": [
"Earth's diameter",
"Earth"
],
"link": "https://astron-soc.in/outreach/activities/archaeo-astronomy-projects/measuring-earths-diameter/",
"displayed_link": "https://astron-soc.in › archaeo-astronomy-projects › m..."
},
{
"position": 7,
"title": "Equator",
"tags": "Dec 1, 2022 —",
"snippet": "Dec 1, 2022 — The distance around Earth at the Equator, its circumference, is 40,075 kilometers (24,901 miles). Earth's diameter is also wider at the Equator, ...",
"highlighs": [
"Earth",
"Earth's diameter"
],
"link": "https://www.nationalgeographic.org/encyclopedia/equator/",
"displayed_link": "https://www.nationalgeographic.org › encyclopedia"
}
],
"related_searches": [
{
"position": 8,
"query": "earth circumference",
"link": "https://www.google.us/search?q=Earth+circumference&sa=X&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDVAnoECCwQAQ"
},
{
"position": 9,
"query": "earth diameter km",
"link": "https://www.google.us/search?q=Earth+diameter+km&sa=X&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDVAnoECCoQAQ"
},
{
"position": 10,
"query": "earth diameter miles",
"link": "https://www.google.us/search?q=Earth+diameter+miles&sa=X&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDVAnoECCkQAQ"
},
{
"position": 11,
"query": "diameter of earth in m",
"link": "https://www.google.us/search?q=Diameter+of+Earth+in+M&sa=X&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDVAnoECCYQAQ"
},
{
"position": 12,
"query": "circumference of earth in m",
"link": "https://www.google.us/search?q=Circumference+of+Earth+in+M&sa=X&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDVAnoECCUQAQ"
},
{
"position": 13,
"query": "how big is the earth",
"link": "https://www.google.us/search?q=How+big+is+the+Earth&sa=X&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDVAnoECCQQAQ"
},
{
"position": 14,
"query": "diameter of earth in feet",
"link": "https://www.google.us/search?q=Diameter+of+Earth+in+feet&sa=X&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDVAnoECCMQAQ"
},
{
"position": 15,
"query": "earth diameter at equator",
"link": "https://www.google.us/search?q=Earth+diameter+at+equator&sa=X&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDVAnoECC0QAQ"
}
],
"pagination": {
"pages_count": 10,
"current_page": 2,
"next_page_url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=20&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEAc",
"prev_page_url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=0&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEAQ",
"pages": [
{
"page": 1,
"url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=0&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEAQ"
},
{
"page": 3,
"url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=20&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEAc"
},
{
"page": 4,
"url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=30&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEAk"
},
{
"page": 5,
"url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=40&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEAs"
},
{
"page": 6,
"url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=50&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEA0"
},
{
"page": 7,
"url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=60&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEA8"
},
{
"page": 8,
"url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=70&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEBE"
},
{
"page": 9,
"url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=80&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEBM"
},
{
"page": 10,
"url": "https://www.google.us/search?q=earth+diameter&ei=Re4dZIvfD4OikdUP0NmbkAg&start=90&sa=N&ved=2ahUKEwjLleGnm_X9AhUDUaQEHdDsBoI4AxDy0wN6BAgDEBU"
}
]
}
}
Last updated