Google Images

The Google Images API allows you to scrape the images from Google Images search results page. 

Endpoint

GET /api/google_images

Parameters

q string Required

The search term that will be used to scrape the images.

page string Optional

Specifies which page of search results to retrieve.

Usage:

  • page=1 or omitted - Returns the first page of results
  • page=2 - Returns the second page of results
  • page=3 - Returns the third page of results


Request Examples

<?php

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => "https://app.scrappa.co/api/images?q=beautiful+landscapes",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "x-api-key: YOUR_API_KEY_HERE"
    ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}
<?php

use Illuminate\Support\Facades\Http;

$response = Http::timeout(30)
    ->withHeaders(['x-api-key' => 'YOUR_API_KEY_HERE'])
    ->get('https://app.scrappa.co/api/images?q=beautiful+landscapes');

if ($response->successful()) {
    echo $response->body();
} else {
    echo "Error: " . $response->status();
}
const options = {
    method: 'GET',
    headers: {
        'x-api-key': 'YOUR_API_KEY_HERE'
    }
};

fetch('https://app.scrappa.co/api/images?q=beautiful+landscapes', options)
    .then(response => {
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        return response.text();
    })
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
require 'net/http'
require 'uri'

uri = URI.parse("https://app.scrappa.co/api/images?q=beautiful+landscapes")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == 'https'

request = Net::HTTP::Get.new(uri.request_uri)
request['x-api-key'] = 'YOUR_API_KEY_HERE'

begin
    response = http.request(request)
    puts response.body
rescue => e
    puts "Error: #{e.message}"
end
import http.client
import json

conn = http.client.HTTPSConnection("app.scrappa.co")

headers = {
    'x-api-key': 'YOUR_API_KEY_HERE',
}

try:
    conn.request("GET", "/api/images?q=beautiful+landscapes", headers=headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
except Exception as e:
    print(f"Error: {e}")
finally:
    conn.close()
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;

public class ApiExample {
    public static void main(String[] args) {
        OkHttpClient client = new OkHttpClient();

        Request request = new Request.Builder()
            .url("https://app.scrappa.co/api/images?q=beautiful+landscapes")
        .addHeader("x-api-key", "YOUR_API_KEY_HERE")
            .build();

        try (Response response = client.newCall(request).execute()) {
            if (response.isSuccessful()) {
                System.out.println(response.body().string());
            } else {
                System.out.println("Error: " + response.code());
            }
        } catch (IOException e) {
            System.out.println("Error: " + e.getMessage());
        }
    }
}

Response Schema

[
    {
        "title": "JSON Results",
        "description": null,
        "json_sample": [
            {
                "link": "https://www.cntraveler.com/gallery/best-coffee-shops-in-berlin",
                "title": "8 Best Coffee Shops in Berlin | Cond\u00e9 Nast Traveler",
                "source": "Cond\u00e9 Nast Traveler",
                "original": "https://media.cntraveler.com/photos/5b96a3a1a02c09535dded622/4:3/w_1136,h_852,c_limit/Hallesches-Haus.jpg",
                "position": 1,
                "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSmEBC1ISlB_8m5Kan8mGqmJXWJGaLpFD-hRA&s",
                "is_product": false,
                "original_width": 1136,
                "original_height": 852
            },
            {
                "link": "https://perfectdailygrind.com/2019/04/a-specialty-coffee-shop-tour-of-berlin/",
                "title": "A Specialty Coffee Shop Tour of Berlin, Germany - Perfect Daily Grind",
                "source": "Perfect Daily Grind",
                "original": "https://perfectdailygrind.com/wp-content/uploads/2019/04/bonanzacoffee_1_4_2019_17_52_0_351-1080x560-1.jpg",
                "position": 2,
                "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS800LIU9ha8r8_UB8fL6vmvhRA1okDzVIIqw&s",
                "is_product": false,
                "original_width": 1080,
                "original_height": 560
            }
        ]
    }
]

Try It Live

Test this endpoint in our interactive playground with real data.

Open in Playground