### Baidu Search API Request Examples Source: https://docs.scrapingdog.com/baidu-scraper-api/baidu-search-api Demonstrates how to perform a Baidu search using the Scrapingdog API. It includes examples for cURL, Python, Node.js, PHP, Ruby, and Java. Ensure you have the necessary libraries installed (e.g., requests for Python, axios for Node.js). The output is the JSON response from the API or an error message. ```cURL curl "https://api.scrapingdog.com/baidu/search/?api_key=5eaa61a6e562fc52fe763tr516e4653&query=football" ``` ```Python import requests api_key = "5eaa61a6e562fc52fe763tr516e4653" url = "https://api.scrapingdog.com/baidu/search/" params = { "api_key": api_key, "query": "football" } 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}") ``` ```Node JS const axios = require('axios'); const api_key = '5eaa61a6e562fc52fe763tr516e4653'; const url = 'https://api.scrapingdog.com/baidu/search/'; const params = { api_key: api_key, query: 'football' }; axios .get(url, { params: params }) .then(function (response) { if (response.status === 200) { const data = 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 { if (response.status === 200) { const data = response.data; console.log(data); } else { console.log(`Request failed with status code ${response.status}`); } }) .catch((error) => { console.error('Request failed with an error:', error); }); ``` -------------------------------- ### Fetch Google Shorts Data via API (Node.js) Source: https://docs.scrapingdog.com/google-shorts-api This Node.js example uses the `axios` library to fetch Google Shorts data. It demonstrates making a GET request with parameters and handling the response or errors. ```javascript const axios = require('axios'); const api_key = '5eaa61a6e562fc52fe763tr516e4653'; const url = 'https://api.scrapingdog.com/google_shorts'; const params = { api_key: api_key, query: 'football', country: 'us' }; axios .get(url, { params: params }) .then(function (response) { if (response.status === 200) { const data = 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); }); ``` -------------------------------- ### Scrapingdog Search API (Java Example) Source: https://docs.scrapingdog.com/bing-search-scraper-api This section demonstrates how to perform a search using the Scrapingdog API with Java. It includes setting up the API key, query parameters, constructing the URL, making the GET request, and processing the response. ```APIDOC ## GET /bing/search/ ### Description This endpoint allows you to perform searches using the Scrapingdog API, specifically targeting the Bing search engine. ### Method GET ### Endpoint `https://api.scrapingdog.com/bing/search/` ### Parameters #### Query Parameters - **api_key** (string) - Required - Your unique Scrapingdog API key. - **query** (string) - Required - The search query string. - **cc** (string) - Optional - The country code for the search (e.g., 'us'). ### Request Example ```java // Construct the API endpoint URL String apiKey = "YOUR_API_KEY"; String query = "what+is+api"; String cc = "us"; String apiUrl = "https://api.scrapingdog.com/bing/search/?api_key=" + apiKey + "&query=" + query + "&cc=" + cc; ``` ### Response #### Success Response (200) - **response** (string) - The search results in string format. #### Response Example ```json { "example": "[Search results from Bing]" } ``` #### Error Response - **responseCode** (integer) - The HTTP status code indicating an error. #### Error Response Example ``` HTTP request failed with response code: 400 ``` ``` -------------------------------- ### Scrape X Profile Data using Node.js Source: https://docs.scrapingdog.com/x-scraper-api/x-profile-scraper-api This Node.js example utilizes the 'axios' library to scrape X profile data. It sends a GET request with the API key and profile ID, then logs the JSON response or any errors. Make sure to install 'axios' (`npm install axios`). ```javascript const axios = require('axios'); const api_key = '5eaa61a6e562fc52fe763tr516e4653'; const profileId = 'elonmusk'; const params = { api_key, profileId }; axios .get('https://api.scrapingdog.com/x/profile', { params }) .then((response) => { if (response.status === 200) { // Parse the JSON response const responseData = response.data; console.log(responseData); } else { console.error(`Request failed with status code: ${response.status}`); } }) .catch((error) => { console.error('An error occurred:', error); }); ``` -------------------------------- ### Fetch Walmart Reviews with Java Source: https://docs.scrapingdog.com/walmart-scraper-api/walmart-reviews-scraper This Java example uses the `java.net` package to fetch Walmart reviews from the ScrapingDog API. It constructs the API URL with query parameters, opens a connection, sends a GET request, and prints the response data if the request is successful. Error handling is included. ```Java import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static void main(String[] args) { String apiURL = "https://api.scrapingdog.com/walmart/reviews"; String apiKey = "5eaa61a6e562fc52fe763tr516e4653"; String url = "https://www.walmart.com/reviews/product/317408869"; try { // Create the URL with query parameters URL url = new URL(apiURL + "?api_key=" + apiKey + "&url=" + url); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); // Set the request method to GET connection.setRequestMethod("GET"); // Get the response code int responseCode = connection.getResponseCode(); if (responseCode == 200) { // Read the response data BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; StringBuilder response = new StringBuilder(); while ((line = reader.readLine()) != null) { response.append(line); } reader.close(); // Print the response data System.out.println(response.toString()); } else { System.out.println("Request failed with response code: " + responseCode); } } catch (IOException e) { e.printStackTrace(); } } } ``` -------------------------------- ### Make a Search Request using Node.js Source: https://docs.scrapingdog.com/universal-search-api This Node.js example uses the 'axios' library to perform a GET request to the Scrapingdog Universal Search API. It includes the API key and search query in the request parameters. The script logs the JSON response or an error message. Make sure to install 'axios' (`npm install axios`). ```javascript const axios = require('axios'); const api_key = '5eaa61a6e562fc52fe763tr516e4653'; const url = 'https://api.scrapingdog.com/search/'; const params = { api_key: api_key, query: 'football' }; axios .get(url, { params: params }) .then(function (response) { if (response.status === 200) { const data = 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); }); ``` -------------------------------- ### Fetch Product Data with Ruby Source: https://docs.scrapingdog.com/flipkart-scraper-api/flipkart-product-api This Ruby example uses the `net/http` and `json` libraries to make a GET request to the ScrapingDog API. It constructs the URL with query parameters for the API key and product URL. The response is checked for success, and the JSON data is parsed and printed. Requires the `net/http` and `json` libraries. ```ruby require 'net/http' require 'json' api_url = 'https://api.scrapingdog.com/flipkart/product' api_key = 'APIKEY' url = 'https://www.flipkart.com/samsung-essential-series-s3-60-4-cm-24-inch-full-hd-led-backlit-ips-panel-d-sub-hdmi-flat-monitor-ls24d300gawxxl/p/itm909c8202e1864' params = { 'api_key' => api_key, 'url' => url } uri = URI(api_url) uri.query = URI.encode_www_form(params) response = Net::HTTP.get_response(uri) if response.is_a?(Net::HTTPSuccess) data = JSON.parse(response.body) puts data else puts "Request failed with status code #{response.code}" end ``` -------------------------------- ### Fetch Walmart Reviews with Ruby Source: https://docs.scrapingdog.com/walmart-scraper-api/walmart-reviews-scraper This Ruby example uses the `net/http` and `json` libraries to fetch Walmart reviews from the ScrapingDog API. It constructs the API URL with query parameters, sends a GET request, and prints the response data if the request is successful. Error handling is included. ```Ruby require 'net/http' require 'json' api_url = 'https://api.scrapingdog.com/walmart/reviews' api_key = '5eaa61a6e562fc52fe763tr516e4653' url = 'https://www.walmart.com/reviews/product/317408869' params = { 'api_key' => api_key, 'url' => url } uri = URI(api_url) uri.query = URI.encode_www_form(params) response = Net::HTTP.get_response(uri) if response.is_a?(Net::HTTPSuccess) data = JSON.parse(response.body) puts data else puts "Request failed with status code #{response.code}" end ``` -------------------------------- ### Fetch Google AI Overview using Node.js Source: https://docs.scrapingdog.com/google-ai-overview-api This Node.js example utilizes the `axios` library to interact with the Scrapingdog Google AI Overview API. It requires your API key and the AI overview URL. The code makes a GET request and logs the response data if the request is successful, otherwise it logs an error. Make sure to install `axios` (`npm install axios`). ```javascript const axios = require('axios'); const api_key = '5eaa61a6e562fc52fe763tr516e4653'; const url = 'https://api.scrapingdog.com/google/ai_overview/'; const params = { api_key: api_key, query: 'ai_overview_url' }; axios .get(url, { params: params }) .then(function (response) { if (response.status === 200) { const data = 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); }); ``` -------------------------------- ### Google Hotels API Request Source: https://docs.scrapingdog.com/google-hotels-api This example demonstrates how to make a GET request to the Google Hotels API using Java to retrieve hotel information. ```APIDOC ## GET /google_hotels/ ### Description Retrieves hotel information from Google Hotels based on provided query parameters. ### Method GET ### Endpoint https://api.scrapingdog.com/google_hotels/ ### Parameters #### Query Parameters - **api_key** (string) - Required - Your Scrapingdog API key. - **query** (string) - Required - The search query for hotels (e.g., "Hotels in New York"). - **check_in_date** (string) - Required - The check-in date in YYYY-MM-DD format. - **check_out_date** (string) - Required - The check-out date in YYYY-MM-DD format. - **proerty_token** (string) - Required - The property token for specific hotel searches. ### Request Example ```java String apiKey = "APIKEY"; String query = "Hotels in New York"; String check_in_date = "2025-08-21"; String check_out_date = "2025-08-22"; String property_token = "CgoIjrCvh-j2tN5-EAE"; String apiUrl = "https://api.scrapingdog.com/google_hotels/?api_key=" + apiKey + "&query=" + query + "&check_in_date=" + check_in_date + "&check_out_date=" + check_out_date + "&proerty_token=" + property_token; ``` ### Response #### Success Response (200) - **response** (string) - The JSON response containing hotel information. #### Response Example ```json { "example": "{\"hotels\": [ { \"name\": \"Example Hotel\", \"rating\": 4.5, \"price\": \"$200\" } ]}" } ``` #### Error Response - **response** (string) - An error message indicating the failure. #### Error Response Example ``` HTTP request failed with response code: 400, message: Bad Request ``` ``` -------------------------------- ### Handle Product Extensions Source: https://docs.scrapingdog.com/google-search-scraper-api/google-response-breakdown/inline-shopping-results This example shows how to process product extensions, specifically 'Sale' in this case. It's a simple key-value pair that can be used to identify promotional items. ```json { "extensions": "Sale" } ``` -------------------------------- ### Fetch Walmart Reviews with Python Source: https://docs.scrapingdog.com/walmart-scraper-api/walmart-reviews-scraper This Python example uses the `requests` library to fetch Walmart reviews from the ScrapingDog API. It defines the API endpoint and parameters, sends a GET request, and prints the response data if the request is successful. Error handling is included. ```Python import requests url = "https://api.scrapingdog.com/walmart/reviews" params = { "api_key": "5eaa61a6e562fc52fe763tr516e4653", "url": "https://www.walmart.com/reviews/product/317408869" } 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}") ``` -------------------------------- ### Scrapingdog Google API Request Examples Source: https://docs.scrapingdog.com/google-search-scraper-api Demonstrates how to make requests to the Scrapingdog Google API using various programming languages and cURL. These examples show how to set parameters for search queries, results count, country, and pagination. ```bash curl "https://api.scrapingdog.com/google/?api_key=5eaa61a6e562fc52fe763tr516e4653&query=football&results=10&country=us&page=0" ``` ```python import requests api_key = "5eaa61a6e562fc52fe763tr516e4653" url = "https://api.scrapingdog.com/google/" params = { "api_key": api_key, "query": "football", "results": '10', "country": "us", "page": '0' } 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}") ``` ```javascript const axios = require('axios'); const api_key = '5eaa61a6e562fc52fe763tr516e4653'; const url = 'https://api.scrapingdog.com/google/'; const params = { api_key: api_key, query: 'football', results: '10', country: 'us', page: '0', }; axios .get(url, { params: params }) .then(function (response) { if (response.status === 200) { const data = 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 { if (response.status === 200) { const data = response.data; console.log(data); } else { console.log(`Request failed with status code ${response.status}`); } }) .catch((error) => { console.error('Request failed with an error:', error); }); ```