Using Google News API you can scrape Google News results without worrying about proxy rotation and data parsing. Our API is fast and reliable. Each successful request will cost you 5 API credits.
import requestsapi_key ="5eaa61a6e562fc52fe763tr516e4653"url ="https://api.scrapingdog.com/google_shopping"params ={"api_key": api_key,"query":"shoes","results":10,"country":"in"}response = requests.get(url, params=params)if response.status_code ==200: data = response.json()print(data)else:print(f"Request failed with status code: {response.status_code}")
constaxios=require('axios');constapi_key='5eaa61a6e562fc52fe763tr516e4653';consturl='https://api.scrapingdog.com/google_shopping';constparams= { api_key: api_key, query:'shoes', results:10, country:'in'};axios.get(url, { params: params }).then(function (response) {if (response.status ===200) {constdata=response.data;console.log(data) } else {console.log('Request failed with status code: '+response.status); } }).catch(function (error) {console.error('Error making the request: '+error.message); });
<?php// Set the API key and request parameters$api_key ='5eaa61a6e562fc52fe763tr516e4653';$query ='shoes';$results =10;$country ='in';// Set the API endpoint$url = 'https://api.scrapingdog.com/google_shopping/?api_key=' . $api_key . '&query=' . $query . '&results=' . $results . '&country=' . $country;
// Initialize cURL session$ch =curl_init($url);// Set cURL optionscurl_setopt($ch, CURLOPT_RETURNTRANSFER,true);// Execute the cURL request$response =curl_exec($ch);// Check if the request was successfulif ($response ===false) {echo'cURL error: '.curl_error($ch);} else {// Process the response data as neededecho $response;}// Close the cURL sessioncurl_close($ch);
require'net/http'require'uri'# Set the API key and request parametersapi_key ='5eaa61a6e562fc52fe763tr516e4653'query ='shoes'results =10country ='in'# Construct the API endpoint URLurl = URI.parse("https://api.scrapingdog.com/google_shopping/?api_key=#{api_key}&query=#{query}&results=#{results}&country=#{country}")
# Create an HTTP GET requestrequest =Net::HTTP::Get.new(url)# Create an HTTP clienthttp =Net::HTTP.new(url.host, url.port)http.use_ssl =true# Enable SSL (https)# Send the request and get the responseresponse = http.request(request)# Check if the request was successfulif response.is_a?(Net::HTTPSuccess)puts response.body # Process the response data as neededelseputs"HTTP request failed with code: #{response.code}, message: #{response.message}"end
importjava.io.BufferedReader;importjava.io.InputStreamReader;importjava.net.HttpURLConnection;importjava.net.URL;importjava.io.IOException;publicclassMain {publicstaticvoidmain(String[] args) {try {// Set the API key and request parametersString apiKey ="5eaa61a6e562fc52fe763tr516e4653";String query ="shoes";int results =10;String country ="in";// Construct the API endpoint URLString apiUrl ="https://api.scrapingdog.com/google_shopping/?api_key="+ apiKey+"&query="+ query+"&results="+ results+"&country="+ country// Create a URL object from the API URL stringURL url =newURL(apiUrl);// Open a connection to the URLHttpURLConnection connection = (HttpURLConnection) url.openConnection();// Set the request method to GETconnection.setRequestMethod("GET");// Get the response codeint responseCode =connection.getResponseCode();if (responseCode ==200) {// Read the response from the connectionBufferedReader reader =newBufferedReader(new InputStreamReader(connection.getInputStream()));String inputLine;StringBuilder response =newStringBuilder();while ((inputLine =reader.readLine()) !=null) {response.append(inputLine); }reader.close();// Process the response data as neededSystem.out.println(response.toString()); } else {System.out.println("HTTP request failed with response code: "+ responseCode); }// Close the connectionconnection.disconnect(); } catch (IOException e) {e.printStackTrace(); } }}
Response
{"meta": {"api_key":"APIKEY","q":"shoes","gl":"in" },"filters": [ {"type":"Price","options": [ {"text":"Up to $10","tbs":"mr:1,price:1,ppr_max:10" }, {"text":"$10 – $25","tbs":"mr:1,price:1,ppr_min:10,ppr_max:25" }, {"text":"$25 – $50","tbs":"mr:1,price:1,ppr_min:25,ppr_max:50" }, {"text":"$50 – $100","tbs":"mr:1,price:1,ppr_min:50,ppr_max:100" }, {"text":"Over $100","tbs":"mr:1,price:1,ppr_min:100" } ] }, ..... ],"ads": [ {"position":1,"title":"Jet Black (Medium and Extra Wide 4E Available) (Sizes 7-16) Medium (D) / 10.5CA$181.85", "link": "https://google.com/aclk?sa=l&ai=DChcSEwjm7dPx6dP5AhUYwsIEHen5B8YYABABGgJwdg&sig=AOD64_0NXIqqoLaeE0blf92DyNSXHBcK3A&ctype=5&q=&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQww8Irw4&adurl=",
"source":"Zeba Shoes","price":"CA$181.85", "thumbnail": "https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcR6bB7yuBN2zjyHSGupV7-aSSHq9mM25NO2UqpxlxY2Og4Wl5JoxkFGPGfnAgMxuVEUniRNFg1w6Ntw0ioJAkgR-EqGwPyb3jOQaxbuOOleyBWbQixVhNSp9w&usqp=CAE"
}, {"position":2,"title":"Fish Slippers Beach Shoes Pool Non-Slip Sandals Men and Women Casual ShoeCA$28.00", "link": "https://google.com/aclk?sa=l&ai=DChcSEwjm7dPx6dP5AhUYwsIEHen5B8YYABADGgJwdg&sig=AOD64_0TRpjhmKzAxJtJ8hKCgv--zqOP-g&ctype=5&q=&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQww8Isg4&adurl=",
"source":"Amazon CA","price":"CA$28.00", "thumbnail": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcQ2W85a9834g1ggN1S4UkccWY3cXT9H5TGO_vUm_F932Qw-kR1UAic73l0SUG4-SA-u7u6zlZ_7VxjF41mQX-55uAuNSh3wdr0hxPHNJXeW_bqbC6pU-2G4&usqp=CAE"
}, .... ],"shopping_results": [ {"position":1,"title":"Nike LeBron XVII Basketball Shoes (White) Size 11", "link": "https://www.goat.com/sneakers/lebron-17-air-command-force-bq3177-100%3Fsrsltid%3DAdGWZVQZVSDhUlCTAvb1HQ4hN3Q6FxUkHZZ1m3UPEgiSIkMo9-V7WMehk1c&rct=j&q=&esrc=s&sa=U&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQguUECMYO&usg=AOvVaw2bJdRrq4-ics8g0aX0LLYu",
"product_link": "https://google.com/shopping/product/14214112555488983868?q=shoes&oq=shoes&gl=us&sourceid=chrome&ie=UTF-8&prds=eto:17557070689024820201_0,pid:6481879233016932111,rsk:PC_16928367288155928171&sa=X&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQ8wIIxA4",
"product_id":"6481879233016932111","source":"GOAT","price":"$239.00","rating":"4.6","thumbnail":"data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==","delivery":"$13.50 delivery","extensions":"LOW PRICE" }, {"position":2,"title":"Converse Chuck Taylor All Star Classic High Top (White Size 13) Unisex Canvas Shoes", "link": "https://www.converse.com/shop/p/chuck-taylor-all-star-classic-unisex-high-top-shoe/171750F_130.html%3Fcp%3DPLA_PRF_CNV_NA_US_EN_20200429_CPCS_Surfaces_X_X_X_X_Google_X_X_194432988514_X_X_X&rct=j&q=&esrc=s&sa=U&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQguUECNYO&usg=AOvVaw1IOjq4GdI_OaSRpSxPriQ_",
"product_link": "https://google.com/shopping/product/16525774757933753875?q=shoes&oq=shoes&gl=us&sourceid=chrome&ie=UTF-8&prds=eto:9965886655953646673_0,pid:10340401949653974827&sa=X&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQ8wII1Q4",
"product_id":"10340401949653974827","source":"Converse","price":"$65.00","thumbnail":"data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==","delivery":"Free delivery by Sep 6 & Free 30-day returns" }, .... ],}
api_key
required
Your personal API key. Available on your dashboard
Type: String
query
required
This can be any Google query or a complete Google URL. Example1 - query=shoes
country
This is the ISO code of the country from which you are seeking Google search results.
Default Value - us
Type - String
page
This is the page number of Google searches. Its value can be 0 for the first page, 1 for the second page, and so on.
Default Value - 0
Type - String
domain
To obtain local results from a specific country, for example, for India, it will be "google.co.in," and for the UK, it will be "google.co.uk".
Type: String
Default: "google.com"
language
Language of the results. Possible Values - en, es, fr, de, etc.
Default Value - en
Type - String
lr
Type: String Limit the search to one or multiple languages.
It is used as lang_{language code}.
For example - "lang_us"
result_time
The "tbs" parameter is often accompanied by additional parameters that define specific search options.
These options can include parameters such as time range, language, country, file type, and more.
Possible Value - qdr:d
Type - String
tbs
o be searched - An advanced parameter to filter search results.
Type: String
safe
To filter the adult content set safe to active or to disable it set off.
Type: String [active/off]
Default: off
nfpr
It can be set to 1 to exclude these results or 0 to include them.
Type: Boolean
Default: 0 It excludes the result from an auto-corrected query that is spelled wrong.