Our google_lens source enables you to extract results from the Google Lens feature while performing an image search.
Explore output data dictionary for each Lens SERP feature, offering a brief description, screenshot, parsed JSON code snippet, and a table defining each parsed field. Navigate through the details using the right-side navigation or scrolling down the page.
Request samples
The API sends a request to the Google Lens feature to retrieve structured data related to the content of an image.
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
namespace OxyApi
{
class Program
{
static async Task Main()
{
const string Username = "USERNAME";
const string Password = "PASSWORD";
var parameters = new {
source = "google_lens",
query = "https://www.beginningboutique.com.au/cdn/shop/files/Flossie-Pink-Maxi-Sleeveless-Dress_750x.jpg",
parse = true
};
var client = new HttpClient();
Uri baseUri = new Uri("https://realtime.oxylabs.io");
client.BaseAddress = baseUri;
var requestMessage = new HttpRequestMessage(HttpMethod.Post, "/v1/queries");
requestMessage.Content = JsonContent.Create(parameters);
var authenticationString = $"{Username}:{Password}";
var base64EncodedAuthenticationString = Convert.ToBase64String(System.Text.ASCIIEncoding.UTF8.GetBytes(authenticationString));
requestMessage.Headers.Add("Authorization", "Basic " + base64EncodedAuthenticationString);
var response = await client.SendAsync(requestMessage);
var contents = await response.Content.ReadAsStringAsync();
Console.WriteLine(contents);
}
}
}
package org.example;
import okhttp3.*;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;
public class Main implements Runnable {
private static final String AUTHORIZATION_HEADER = "Authorization";
public static final String USERNAME = "USERNAME";
public static final String PASSWORD = "PASSWORD";
public void run() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("source", "google_lens");
jsonObject.put("query", "https://www.beginningboutique.com.au/cdn/shop/files/Flossie-Pink-Maxi-Sleeveless-Dress_750x.jpg");
jsonObject.put("parse", true);
Authenticator authenticator = (route, response) -> {
String credential = Credentials.basic(USERNAME, PASSWORD);
return response
.request()
.newBuilder()
.header(AUTHORIZATION_HEADER, credential)
.build();
};
var client = new OkHttpClient.Builder()
.authenticator(authenticator)
.readTimeout(180, TimeUnit.SECONDS)
.build();
var mediaType = MediaType.parse("application/json; charset=utf-8");
var body = RequestBody.create(jsonObject.toString(), mediaType);
var request = new Request.Builder()
.url("https://realtime.oxylabs.io/v1/queries")
.post(body)
.build();
try (var response = client.newCall(request).execute()) {
if (response.body() != null) {
try (var responseBody = response.body()) {
System.out.println(responseBody.string());
}
}
} catch (Exception exception) {
System.out.println("Error: " + exception.getMessage());
}
System.exit(0);
}
public static void main(String[] args) {
new Thread(new Main()).start();
}
}
Device type and browser. The full list can be found here.
desktop
- mandatory parameter
Localization
Adapt search results to specific geographical locations and languages.
Parameter
Description
Default Value
geo_location
The geographical location that the result should be adapted for. Using this parameter correctly is extremely important to get the right data. For more information, read about our suggested geo_location parameter structures here.
-
locale
Accept-Language header value which changes your Google search page web interface language. More info.
This table outlines the key elements of a Google Lens search result. The table below presents a detailed list of each SERP feature we parse, along with its description and data type. The table also includes some metadata.
Key
Description
Type
results
A dictionary containing the results of the search.
array
results.organic
A list of unpaid image results with their respective details.
array
total_results_count
The total number of results found for the image URL.
integer
parse_status_code
The status code of the parsing job. You can see the parser status codes described here.
integer
created_at
The timestamp when the scraping job was created.
timestamp
updated_at
The timestamp when the scraping job was finished.
timestamp
page
Page number relative to the Google SERP pagination.
integer
job_id
The ID of the job associated with the scraping job.
string
status_code
The status code of the scraping job. You can see the scraper status codes describedhere.
integer
Organic
Google Lens accounts multiple factors to deliver the most relevant and useful information to users based on the content of the image user uploads.