> ## Content Index
> Fetch the complete content index at: https://serpapi.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Scrape Google Lens Results
- URL: https://serpapi.com/blog/how-to-scrape-google-lens-results/
- Published: 2024-03-14T11:47:20.000Z
- Updated: 2024-03-26T01:49:04.000Z
- Author: Andy L
- Tags: Google Lens

Google Lens is a powerful search tool. Google uses the latest technology to analyze images and provide useful information. Google Lens can recognize text, objects, people, plants, animals, etc.

You can use Google Lens to search for information about a product, or similar images.

![](https://lh7-us.googleusercontent.com/2F842Sr_BPyEgzlpxIeBEDxAek6_CVfmy3dw2CGdi8BPI385d8wPcgCnHuDv-HEDnwv-BzC5kNaA7olG6LT2w-_DKpVXEhBzosdLrx8dfzd_eyPXl_me7TEUV3wonbzb5xz0pSHEClKP8oJwOdM-2fM)

[SerpApi](https://serpapi.com/) is the leading SERP API solution and we also provide a high-quality Google Lens API. Scraping Google Lens results can help you to collect data on objects, text, people, and more to use for training machine learning models or creating new AI applications.

Let's see how it works with SerpApi Google Lens API.

![](https://lh7-us.googleusercontent.com/g-JmCk4uU-I9vPvEr8YJP4XRmD99qJiNRW2RTa6KiyyZWGDOxvSR201iDMoSpEHqwmfLGzH95xjIpB82wlPwiCuK3GPgw0GtdJo8CBBE7PBJgrSzT1UReJ5qAMd0jJZGWwflb0rUwQrW6uNIUBKm6LA)

### Setting Up a SerpApi Account

[SerpApi](https://serpapi.com/) offers a free plan for newly created accounts. Head to the [sign-up](https://serpapi.com/users/sign%5Fup?plan=free) page to register an account and complete your first search with our [interactive playground](https://serpapi.com/playground?engine=google%5Flens). When you want to do more searches with us, please visit the [pricing page](https://serpapi.com/pricing).

Once you are familiar with all the results, you can utilize SERP APIs using your [API Key](https://serpapi.com/manage-api-key).

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2024/03/Screenshot-2024-03-14-at-18.18.13.png)

### Scrape your First Google Lens Results with SerpApi

Head to the Google Lens Results from the [documentation](https://serpapi.com/google-lens-api) on [SerpApi](https://serpapi.com/) for details.

In this tutorial, we will scrape all videos related to an [AirPod](https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcT27QuyhDk7UGeqc-sOA%5FVs9BJp--vhGzxP6Ws3l7nH5EffyAJ0PJK3SPcLPqxq3lQKJ8-i3CIQ-QD%5FlLevz3dZPfW4Dy%5Fp&usqp=CAY) product. The data contains: "title", "link", "source", "profile\_name", "thumbnail" and more. You can also scrape more information with [SerpApi](https://serpapi.com/).

First, you need to install the [SerpApi client library](https://github.com/serpapi/google-search-results-python?ref=serpapi.com).

```python
pip install google-search-results
```

Set up the[ SerpApi](https://serpapi.com/?ref=serpapi.com)[ credentials](https://serpapi.com/manage-api-key?ref=serpapi.com) and search.

```python
from serpapi import GoogleSearch
import os, json, csv

params = {
    'api_key': 'YOUR_API_KEY',             # your serpapi api
    'engine': 'google_lens',        # SerpApi search engine
    'url': 'https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcT27QuyhDk7UGeqc-sOA_Vs9BJp--vhGzxP6Ws3l7nH5EffyAJ0PJK3SPcLPqxq3lQKJ8-i3CIQ-QD_lLevz3dZPfW4Dy_p&usqp=CAY'
}

```

To retrieve Google Lens Results for a given search query, you can use the following code:

```python
results = GoogleSearch(params).get_dict()['video_results']

```

You can store Google Lens Results JSON data in databases or export them to a CSV file.

```python
import csv

header = ["title", "link", "source", "profile_name", "video", "thumbnail"]

with open('goole_lens.csv', 'w', encoding='UTF8', newline='') as f:
    writer = csv.writer(f)

    writer.writerow(header)

    for item in results:
        print(item)
        writer.writerow([item.get('title'), item.get('link'), item.get('source'), item.get('profile_name'), item.get('thumbnail')])

```

This example is using Python, but you can also use all your favorite programming languages like Ruby, NodeJS, Java, PHP, and more.

If you have any questions, please feel free to [contact me](mailto:andy@serpapi.com).