# 图片搜索

该 `google_search` 来源用于检索 Google 搜索结果（SERP）。此子页面专门展示与 Google 图片搜索相关的数据。要了解其他结果类型，请阅读这里： [**网页搜索**](https://github.com/oxylabs/gitbook-public-english/blob/master/scraping-solutions/web-scraper-api/targets/google/search/broken-reference/README.md), [**新闻搜索**](https://github.com/oxylabs/gitbook-public-english/blob/master/scraping-solutions/web-scraper-api/targets/google/search/broken-reference/README.md).

{% hint style="warning" %}
要抓取 Google 图片搜索，请包含 `context:udm` 参数，其值设置为 `2` 或 `context:tbm` 参数，其值设置为 `isch`.
{% endhint %}

{% hint style="info" %}
查看输出 [**数据字典**](#data-dictionary) 了解每个图片 SERP 功能，提供简要说明、截图、解析后的 JSON 代码片段，以及定义每个解析字段的表格。可通过右侧导航或向下滚动页面浏览详细内容。
{% endhint %}

## 请求示例

在下面的示例中，我们发起请求以获取搜索词 `adidas`.

### udm

{% tabs %}
{% tab title="cURL" %}

```shell
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "google_search",
        "query": "adidas",
        "parse": true,
        "context": [
            {
                "key": "udm",
                "value": "2"
            }
        ]
    }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from pprint import pprint

# 结构化负载。
payload = {
    'source': 'google_search',
    'query': 'adidas',
    'parse': True,
    'context': [
        {'key': 'udm', 'value': '2'},
    ],
}

# 获取响应。
response = requests.post(
    'https://realtime.oxylabs.io/v1/queries',
    auth=('USERNAME', 'PASSWORD'),
    json=payload,
)

# 将美化后的响应打印到标准输出。
pprint(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require("https");

const username = "USERNAME";
const password = "PASSWORD";
const body = {
    source: "google_search",
    query: "adidas",
    parse: true,
    context: [
        { key: "udm", value: "2" },
    ],
};

const options = {
    hostname: "realtime.oxylabs.io",
    path: "/v1/queries",
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        Authorization:
            "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
    },
};

const request = https.request(options, (response) => {
    let data = "";

    response.on("data", (chunk) => {
        data += chunk;
    });

    response.on("end", () => {
        const responseData = JSON.parse(data);
        console.log(JSON.stringify(responseData, null, 2));
    });
});

request.on("error", (error) => {
    console.error("Error:", error);
});

request.write(JSON.stringify(body));
request.end();
```

{% endtab %}

{% tab title="HTTP" %}

```http
https://realtime.oxylabs.io/v1/queries?source=google_search&query=adidas&parse=true&context[0][key]=udm&context[0][value]=2&access_token=12345abcde
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$params = array(
    'source' => 'google_search',
    'query' => 'adidas',
    'parse' => true,
    'context' => [
        [
            'key' => 'udm',
            'value' => '2',
        ]
    ]
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://realtime.oxylabs.io/v1/queries");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "USERNAME" . ":" . "PASSWORD");


$headers = array();
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	const Username = "USERNAME"
	const Password = "PASSWORD"

	payload := map[string]interface{}{
		"source": "google_search",
		"query":  "adidas",
		"parse":  true,
		"context": []map[string]interface{}{
			{"key": "udm", "value": "2"},
		},
	}

	jsonValue, _ := json.Marshal(payload)

	client := &http.Client{}
	request, _ := http.NewRequest("POST",
		"https://realtime.oxylabs.io/v1/queries",
		bytes.NewBuffer(jsonValue),
	)

	request.SetBasicAuth(Username, Password)
	response, _ := client.Do(request)

	responseText, _ := ioutil.ReadAll(response.Body)
	fmt.Println(string(responseText))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
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_search",
                query = "adidas",
                parse = true,
                context = new dynamic [] {
                    new { key = "udm", value = "2" },
                }
            };

            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);
        }
    }
}
```

{% endtab %}

{% tab title="Java" %}

```java
package org.example;

import okhttp3.*;
import org.json.JSONArray;
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_search");
        jsonObject.put("query", "adidas");
        jsonObject.put("parse", true);
        jsonObject.put("context", new JSONArray()
                .put(new JSONObject()
                        .put("key", "udm")
                        .put("value", "2"))
        );

        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();
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
    "source": "google_search",
    "query": "adidas",
    "parse": true,
    "context": [
        {
            "key": "udm",
            "value": "2"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### tbm

{% tabs %}
{% tab title="cURL" %}

```shell
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "google_search",
        "query": "adidas",
        "parse": true,
        "context": [
            {
                "key": "tbm",
                "value": "isch"
            }
        ]
    }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from pprint import pprint

# 结构化负载。
payload = {
    'source': 'google_search',
    'query': 'adidas',
    'parse': True,
    'context': [
        {'key': 'tbm', 'value': 'isch'},
    ],
}

# 获取响应。
response = requests.post(
    'https://realtime.oxylabs.io/v1/queries',
    auth=('USERNAME', 'PASSWORD'),
    json=payload,
)

# 将美化后的响应打印到标准输出。
pprint(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require("https");

const username = "USERNAME";
const password = "PASSWORD";
const body = {
    source: "google_search",
    query: "adidas",
    parse: true,
    context: [
        { key: "tbm", value: "isch" },
    ],
};

const options = {
    hostname: "realtime.oxylabs.io",
    path: "/v1/queries",
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        Authorization:
            "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
    },
};

const request = https.request(options, (response) => {
    let data = "";

    response.on("data", (chunk) => {
        data += chunk;
    });

    response.on("end", () => {
        const responseData = JSON.parse(data);
        console.log(JSON.stringify(responseData, null, 2));
    });
});

request.on("error", (error) => {
    console.error("Error:", error);
});

request.write(JSON.stringify(body));
request.end();
```

{% endtab %}

{% tab title="HTTP" %}

```http
https://realtime.oxylabs.io/v1/queries?source=google_search&query=adidas&parse=true&context[0][key]=tbm&context[0][value]=isch&access_token=12345abcde
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$params = array(
    'source' => 'google_search',
    'query' => 'adidas',
    'parse' => true,
    'context' => [
        [
            'key' => 'tbm',
            'value' => 'isch',
        ]
    ]
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://realtime.oxylabs.io/v1/queries");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "USERNAME" . ":" . "PASSWORD");


$headers = array();
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	const Username = "USERNAME"
	const Password = "PASSWORD"

	payload := map[string]interface{}{
		"source": "google_search",
		"query":  "adidas",
		"parse":  true,
		"context": []map[string]interface{}{
			{"key": "tbm", "value": "isch"},
		},
	}

	jsonValue, _ := json.Marshal(payload)

	client := &http.Client{}
	request, _ := http.NewRequest("POST",
		"https://realtime.oxylabs.io/v1/queries",
		bytes.NewBuffer(jsonValue),
	)

	request.SetBasicAuth(Username, Password)
	response, _ := client.Do(request)

	responseText, _ := ioutil.ReadAll(response.Body)
	fmt.Println(string(responseText))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
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_search",
                query = "adidas",
                parse = true,
                context = new dynamic [] {
                    new { key = "tbm", value = "isch" },
                }
            };

            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);
        }
    }
}
```

{% endtab %}

{% tab title="Java" %}

```java
package org.example;

import okhttp3.*;
import org.json.JSONArray;
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_search");
        jsonObject.put("query", "adidas");
        jsonObject.put("parse", true);
        jsonObject.put("context", new JSONArray()
                .put(new JSONObject()
                        .put("key", "tbm")
                        .put("value", "isch"))
        );

        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();
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
    "source": "google_search",
    "query": "adidas",
    "parse": true,
    "context": [
        {
            "key": "tbm",
            "value": "isch"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

我们在示例中使用同步 [**Realtime**](https://developers.oxylabs.io/documentation/cn/zhua-qu-jie-jue-fang-an/web-scraper-api/integration-methods/realtime) 集成方式。如果你想使用 [**Proxy Endpoint**](https://developers.oxylabs.io/documentation/cn/zhua-qu-jie-jue-fang-an/web-scraper-api/integration-methods/proxy-endpoint) 或异步 [**Push-Pull**](https://developers.oxylabs.io/documentation/cn/zhua-qu-jie-jue-fang-an/web-scraper-api/integration-methods/push-pull) 集成，请参考 [**集成方式**](https://developers.oxylabs.io/documentation/cn/zhua-qu-jie-jue-fang-an/web-scraper-api/integration-methods) 部分。

## 请求参数值

### 通用

用于抓取 Google 图片搜索结果的基础设置和自定义选项。

<table><thead><tr><th width="222">参数</th><th width="350.3333333333333">说明</th><th>默认值</th></tr></thead><tbody><tr><td><mark style="background-color:green;"><strong>source</strong></mark></td><td>设置抓取器。</td><td><code>google_search</code></td></tr><tr><td><mark style="background-color:green;"><strong>query</strong></mark></td><td>要搜索的关键词或短语。</td><td>-</td></tr><tr><td><mark style="background-color:orange;"><strong>context:</strong></mark><br><mark style="background-color:orange;"><strong>udm</strong></mark></td><td>要获取图片搜索结果，请将值设置为 <mark style="background-color:orange;"><strong>2</strong></mark>. 其他可接受的值见 <a href="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzrXw45naRpCZ0Ku9AjY1%2Fuploads%2FeoShpvYuZlb4hGpCIXNG%2Fudm_values%20(eu%2Bus).json?alt=media&#x26;token=a6b77fab-b170-478c-b06f-b8fbf7ab64c7"><strong>这里</strong></a>.</td><td>-</td></tr><tr><td><mark style="background-color:orange;"><strong>context:</strong></mark><br><mark style="background-color:orange;"><strong>tbm</strong></mark></td><td>要获取图片搜索结果，请将值设置为 <mark style="background-color:orange;"><strong>isch</strong></mark>。其他可接受的值： <code>app</code>, <code>blg</code>, <code>bks</code>, <code>dsc</code>, <code>nws</code>, <code>pts</code>, <code>plcs</code>, <code>rcp</code>, <code>lcl.</code></td><td>-</td></tr><tr><td><code>render</code></td><td>当设置为 <code>html</code>. <a href="../../../features/js-rendering-and-browser-control/javascript-rendering"><strong>更多信息</strong></a><strong>.</strong></td><td>-</td></tr><tr><td><code>parse</code></td><td>当设置为 <code>true</code>时返回解析后的数据。查看输出 <a href="#output-data-dictionary"><strong>数据字典</strong></a>.</td><td><code>false</code></td></tr><tr><td><code>callback_url</code></td><td>你的回调端点 URL。 <a href="../../../../integration-methods/push-pull#callback"><strong>更多信息</strong></a>.</td><td>-</td></tr><tr><td><code>user_agent_type</code></td><td>设备类型和浏览器。完整列表可在 <a href="../../../features/http-context-and-job-management/user-agent-type"><strong>这里</strong></a>.</td><td><code>desktop</code></td></tr></tbody></table>

&#x20;   \- 必填参数

\- `udm` 和 `tbm` context 参数不能在同一个抓取请求中同时使用； **请选择其中一个**。同时使用这两个参数可能导致冲突或意外行为。

#### Google 高级搜索运算符

抓取时，你可能会发现将 Google 高级搜索运算符与查询结合使用很有用。它可以让你自定义搜索范围，确保结果更相关、更聚焦。查看这些特殊命令 [**这里**](https://ahrefs.com/blog/google-advanced-search-operators/) 和 [**这里**](https://www.semrush.com/kb/831-how-to-use-google-advanced-search-operators)。请看下面的示例。

```json
{
    "source": "google_search",
    "query": "iphone 15 launch inurl:apple",
}
```

### 本地化

将搜索结果适配到特定地理位置和语言。

<table><thead><tr><th width="222">参数</th><th width="350.3333333333333">说明</th><th>默认值</th></tr></thead><tbody><tr><td><code>geo_location</code></td><td>结果应适配的地理位置。正确使用此参数对获取正确数据极其重要。更多信息请阅读我们建议的 <code>geo_location</code> 参数结构<a href="../../../../features/localization/serp-localization#google"> <strong>这里</strong></a><strong>.</strong></td><td>-</td></tr><tr><td><code>locale</code></td><td><code>Accept-Language</code> 头值，它会更改你的 Google 搜索页面网页界面语言。 <a href="../../../../features/localization/domain-locale-results-language#locale-1"><strong>更多信息</strong></a>.</td><td>-</td></tr></tbody></table>

### 分页

用于管理搜索结果分页和检索的控制项。

<table><thead><tr><th width="222">参数</th><th width="350.3333333333333">说明</th><th width="167">默认值</th></tr></thead><tbody><tr><td><code>start_page</code></td><td>起始页码。</td><td><code>1</code></td></tr><tr><td><code>pages</code></td><td>要检索的页数。</td><td><code>1</code></td></tr></tbody></table>

### 过滤

根据各种条件筛选和细化搜索结果的选项。

<table><thead><tr><th width="245">参数</th><th width="350.3333333333333">说明</th><th>默认值</th></tr></thead><tbody><tr><td><code>context</code>:<code>safe_search</code></td><td>安全搜索。设置为 <code>true</code> 即可启用。</td><td><code>false</code></td></tr><tr><td><code>context</code>:<br><code>tbs</code></td><td><code>tbs</code> 参数。此参数类似于一个容器，用于存放更不常见的 google 参数，例如按日期限制/排序结果，以及其他一些过滤条件，其中部分取决于 <code>tbm</code> 参数（例如 <code>tbs=app_os:1</code> 仅在 <code>tbm</code> 值 <code>app</code>时可用）。更多信息 <a href="https://stenevang.wordpress.com/2013/02/22/google-advanced-power-search-url-request-parameters/"><strong>这里</strong></a>.</td><td>-</td></tr></tbody></table>

### 其他

用于特殊需求的附加高级设置和控制。

<table><thead><tr><th width="222">参数</th><th width="350.3333333333333">说明</th><th>默认值</th></tr></thead><tbody><tr><td><code>context</code>:<br><code>fpstate</code></td><td>将 <code>fpstate</code> 值设置为 <code>aig</code> 会让 Google 加载更多应用。此参数仅在与 <code>render</code> 参数一起使用时才有用。</td><td>-</td></tr><tr><td><code>context</code>:<br><code>nfpr</code></td><td><code>true</code> 将关闭拼写自动更正</td><td><code>false</code></td></tr></tbody></table>

### 上下文参数

所有上下文参数都应添加到 `context` 数组中，作为具有 `键` 和 `值` 对的对象，例如：

```json
...
"context": [
    {
        "key": "filter",
        "value": "0"
    }
]
...
```

## 结构化数据

SERP 爬虫 API 能够提取包含 Google 搜索结果的 HTML 或 JSON 对象，并为结果页的各个元素提供结构化数据。

<details>

<summary><code>google_search</code> 图片结构化输出</summary>

```json
{
    "results": [
        {
            "content": {
                "url": "https://www.google.com/search?q=adidas&tbm=isch&gbv=1&uule=w+CAIQICINdW5pdGVkIHN0YXRlcw&gl=us&hl=en",
                "results": {
                    "organic": [
                        {
                            "pos": 1,
                            "link": "/url?q=https://www.adidas.com/us/superstar-shoes/EG4958.html&sa=U&ved=2ahUKEwiP4pv98dH3AhUY8rsIHTP1C64QqoUBegQIAxAB&usg=AOvVaw1qdoyk_FXXss1qGlPCyT1k",
                            "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQaV6fadzwfHzBcTbF0i3Uat_MLSvoJ6702u7iONGGz2jwdItge9zQTi6gjhg&s",
                            "title": "Men's Superstar Cloud White...",
                            "domain": "www.adidas.com",
                            "pos_overall": 1
                        },
                        ...
                        {
                            "pos": 20,
                            "link": "/url?q=https://www.adidas.com/us/men-shoes&sa=U&ved=2ahUKEwiP4pv98dH3AhUY8rsIHTP1C64QqoUBegQIBRAB&usg=AOvVaw37cvHwAEOJFq55hDO1iXtw",
                            "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTiprl_ce5WWZHyY3fFm2iXpOkhiy3EoOMv7UnuRoZ3zvYcpOS1MCKlzIFuSes&s",
                            "title": "Men's Shoes & Sneakers |...",
                            "domain": "www.adidas.com",
                            "pos_overall": 20
                        }
                    ],
                    "search_information": {
                        "query": "adidas",
                        "showing_results_for": "adidas"
                    },
                    "suggested_searches": [
                        "logo",
                        "shoes",
                        "wallpaper",
                        "superstar",
                        "yeezy",
                        "stan smith",
                        "ultra boost",
                        "nmd",
                        "eqt",
                        "tubular"
                    ]
                },
                "parse_status_code": 12000
            },
            "created_at": "2022-05-09 07:26:14",
            "updated_at": "2022-05-09 07:26:18",
            "page": 1,
            "url": "https://www.google.com/search?q=adidas&tbm=isch&gbv=1&uule=w+CAIQICINdW5pdGVkIHN0YXRlcw&gl=us&hl=en",
            "job_id": "6929330677540195329",
            "status_code": 200,
            "parser_type": "v2"
        }
    ]
}
```

</details>

{% hint style="info" %}
我们只解析 **desktop** 搜索的图片搜索结果。
{% endhint %}

## 输出数据字典

#### HTML 示例

<figure><img src="https://2655358775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzrXw45naRpCZ0Ku9AjY1%2Fuploads%2FdEj2hxiajrl5qZa0tonT%2Fgoogle_image_search_2.png?alt=media&#x26;token=b6496de3-98be-4871-bb7f-959675b23758" alt=""><figcaption></figcaption></figure>

#### JSON 结构

Google 图片搜索的结构化输出包含诸如 `URL`, `page`, `results`等字段。下表详细列出了我们解析的每个 SERP 功能及其说明和数据类型。表中还包含一些元数据。

{% hint style="info" %}
特定结果类型的项目和字段数量可能会因搜索查询而异。
{% endhint %}

<table><thead><tr><th width="315.3333333333333">键 (results.images)</th><th width="299">说明</th><th>类型</th></tr></thead><tbody><tr><td><code>url</code></td><td>Google 搜索页面的 URL。</td><td>字符串</td></tr><tr><td><code>results</code></td><td>包含搜索结果的字典。</td><td>数组</td></tr><tr><td><code>results.organic</code></td><td>未付费结果及其各自详情的列表。</td><td>数组</td></tr><tr><td><code>resaults.search_information</code></td><td>所提交搜索查询的详细信息列表。</td><td>对象</td></tr><tr><td><code>results.suggested_searches</code></td><td>显示在原始搜索查询下方的建议搜索列表。</td><td>数组</td></tr><tr><td><code>parse_status_code</code></td><td>解析任务的状态码。你可以查看此处描述的解析器状态码 <a href="https://github.com/oxylabs/gitbook-public-english/blob/master/scraping-solutions/web-scraper-api/targets/google/search/broken-reference/README.md"><strong>这里</strong></a>.</td><td>整数</td></tr><tr><td><code>created_at</code></td><td>抓取任务创建时的时间戳。</td><td>时间戳</td></tr><tr><td><code>updated_at</code></td><td>抓取任务完成时的时间戳。</td><td>时间戳</td></tr><tr><td><code>page</code></td><td>相对于 Google SERP 分页的页码。</td><td>整数</td></tr><tr><td><code>job_id</code></td><td>与抓取任务关联的任务 ID。</td><td>字符串</td></tr><tr><td><code>status_code</code></td><td>抓取任务的状态码。你可以查看此处描述的抓取器状态码 <a href="https://github.com/oxylabs/gitbook-public-english/blob/master/scraping-solutions/web-scraper-api/targets/google/search/broken-reference/README.md"><strong>这里</strong></a>.</td><td>整数</td></tr></tbody></table>

{% hint style="info" %}
在以下部分中，当某种结果类型有多个项目时，解析后的 JSON 代码片段会被缩短。
{% endhint %}

### 自然结果

Image Search 的 `organic` 部分显示 Google 图片搜索结果中的未付费列表，由 Google 算法按相关性排序。这些结果展示给寻找视觉内容的用户，并在一个与其他搜索结果类型分开的专用部分中显示。

<figure><img src="https://lh7-us.googleusercontent.com/JbIWkxeHN1m-BqIrLFB9pITIkcozrf2PCpbGbacsr1QLzYmJDeon35IyU9NqTciBUMMfRmTxiA9yoXVTFnsffP5uEX9zhQkie_1vMmxZjsQcfM-RNZo5TsZpY8RqkGW1FyIBRYC-Ry3gpRJnGI0V71U" alt=""><figcaption></figcaption></figure>

```json
...
"organic": [
    {
        "pos": 1,
        "link": "/url?q=https://www.amazon.com/Ravensburger-Glitter-Unicorn-Together-Perfectly/dp/B08X4HRQQL&sa=U&ved=2ahUKEwi6suTk3_ODAxWNqZUCHToXDMkQqoUBegQICBAB&usg=AOvVaw0sGY22JL_Z1oVPkKfuOY-T",
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcROtE0idmQWj_8Mt5JJoiLUFyJRSU7VANreAOFSijiLH9HsB4H3IWw8j_SxtA&s",
        "title": "Amazon.com: Ravensburger...",
        "domain": "www.amazon.com",
        "pos_overall": 1
    },
...
]
...
```

<table><thead><tr><th width="200">键 (results.organic)</th><th width="446.3333333333333">说明</th><th>类型</th></tr></thead><tbody><tr><td><code>pos</code></td><td>表示图片在列表中位置的唯一标识。</td><td>字符串</td></tr><tr><td><code>链接</code></td><td>图片所在网站的 URL。</td><td>数组</td></tr><tr><td><code>图片</code></td><td>图片的 URL。</td><td>数组</td></tr><tr><td><code>标题</code></td><td>图片所在文章的标题。</td><td>对象</td></tr><tr><td><code>域名</code></td><td>包含图片结果的网站域名。</td><td>数组</td></tr><tr><td><code>整体位置</code></td><td>表示图片在列表中位置的唯一标识。</td><td>整数</td></tr></tbody></table>

### 搜索信息

`搜索信息` 是一个提供有关搜索查询详细信息的部分。它包括原始搜索词，以及在适用时 Google 自动更正的任何内容。

<figure><img src="https://2655358775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzrXw45naRpCZ0Ku9AjY1%2Fuploads%2FOuuPeQ3rROtLNACkw5ho%2Fgoogle_image_search_1.png?alt=media&#x26;token=51d64373-bc8a-4745-8a64-126dbbe282bc" alt=""><figcaption></figcaption></figure>

```json
...
"search_information": {
    "query": "独角兽",
    "showing_results_for": "独角兽"
},
...
```

<table><thead><tr><th width="294">键（results.search_information）</th><th width="365.3333333333333">说明</th><th>类型</th></tr></thead><tbody><tr><td><code>query</code></td><td>原始搜索词。</td><td>字符串</td></tr><tr><td><code>showing_results_for</code></td><td>搜索结果所显示对应的搜索词。 <code>query</code> 和 <code>showing_results_for</code> 如果 Google 自动更正了提供的搜索词，则可能不同。</td><td>数组</td></tr></tbody></table>

### 建议搜索

该 `suggested_searches` （数组）在 Google 图片搜索中提供与原始查询相关的建议搜索词列表。用户可以浏览这些额外的搜索选项，以细化或扩展图片搜索。

<figure><img src="https://lh7-us.googleusercontent.com/tBGwN37xODwtHFLvQjBK0ZIKPhVR_JCupNCFno6vIbjDZXBlXb0NB6DH2cXgxz5fBLtttvnxQsNKRx4TV9kZOh7MZ9535dMdka3iAzrogVCtLBptZgv6y-db7F40myz00XYmPQvqUTdSbBP4E7eHyw8" alt=""><figcaption></figcaption></figure>

```json
...
"suggested_searches": [
    "可爱",
    "彩虹",
    "绘画",
    "闪粉",
    "wallpaper",
    "银河",
    "kawaii",
    "简单",
    "剪贴画",
    "透明"
]
...
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.oxylabs.io/documentation/cn/zhua-qu-jie-jue-fang-an/web-scraper-api/targets/google/search/image-search.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
