> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/dian-zi-shang-wu/the-home-depot.md).

# The Home Depot

了解如何开始抓取 The Home Depot。

Home Depot 没有专用的数据源。您可以使用 `universal` 数据源抓取其页面，只需传入页面 `url`。产品页面有专用解析器：添加 `"parse": true` 即可接收结构化 JSON，而不是页面 HTML。

{% hint style="warning" %}
对于某些目标，即使您未设置 **也会强制启用 JavaScript 渲染** ，我们的系统仍会 `render`；此类请求会计入渲染流量。有关强制渲染的目标列表以及如何关闭渲染，请参阅 [对特定页面强制启用渲染](https://developers.oxylabs.io/products/cn/web-scraper-api/features/js-rendering-and-browser-control.md#forcing-rendering-on-specific-pages).
{% endhint %}

<table><thead><tr><th width="148.91015625">页面类型</th><th width="416.44140625">URL 格式</th><th width="71.31640625">解析器</th></tr></thead><tbody><tr><td><a href="#search"><strong>搜索页面</strong></a></td><td><code>https://www.homedepot.com/s/&#x3C;search-term></code></td><td>否</td></tr><tr><td><a href="#product"><strong>产品页面</strong></a></td><td><code>https://www.homedepot.com/p/&#x3C;product-name>/&#x3C;product-id></code></td><td>是</td></tr><tr><td><a href="#category"><strong>类别页面</strong></a></td><td><code>https://www.homedepot.com/b/&#x3C;category-path>/N-&#x3C;category-id></code></td><td>否</td></tr></tbody></table>

{% hint style="info" %}
除了下方列出的参数，您还可以添加 `user_agent_type`, `geo_location`, `render`等其他参数，以自定义抓取请求。了解更多信息，请参阅 [此处](https://developers.oxylabs.io/products/cn/web-scraper-api/features.md).
{% endhint %}

## 搜索

### 请求示例

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

```shell
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "universal",
        "url": "https://www.homedepot.com/s/drill",
        "render": "html"
    }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from pprint import pprint

# Structure payload.
payload = {
    'source': 'universal',
    'url': 'https://www.homedepot.com/s/drill',
    'render': 'html'
}

# Get response.
response = requests.request(
    'POST',
    'https://realtime.oxylabs.io/v1/queries',
    auth=('USERNAME', 'PASSWORD'),
    json=payload
)

# 不再返回包含任务状态和结果 URL 的响应，而是返回
# 包含结果的 JSON 响应。
pprint(response.json())
```

{% endtab %}

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

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

const username = "USERNAME";
const password = "PASSWORD";
const body = {
    source: "universal",
    url: "https://www.homedepot.com/s/drill",
    render: "html"
};

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
# 提交的整个字符串必须进行 URL 编码。

https://realtime.oxylabs.io/v1/queries?source=universal&url=https://www.homedepot.com/s/drill&render=html&access_token=12345abcde
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$params = array(
    'source' => 'universal',
    'url' => 'https://www.homedepot.com/s/drill',
    'render' => 'html'
);

$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": "universal",
        "url": "https://www.homedepot.com/s/drill",
        "render": "html",
    }

    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 = "universal",
                url = "https://www.homedepot.com/s/drill",
                render = "html"
            };

            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.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", "universal");
        jsonObject.put("url", "https://www.homedepot.com/s/drill");
        jsonObject.put("render", "html");

        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": "universal",
    "url": "https://www.homedepot.com/s/drill",
    "render": "html"
}
```

{% endtab %}
{% endtabs %}

### 请求参数值

<table><thead><tr><th width="180">参数</th><th>说明</th><th width="160">默认值</th></tr></thead><tbody><tr><td><mark style="background-color:green;"><strong><code>source</code></strong></mark></td><td>设置抓取器。Home Depot 页面使用 <code>universal</code> 来源进行抓取。</td><td><code>universal</code></td></tr><tr><td><mark style="background-color:green;"><strong><code>url</code></strong></mark></td><td>搜索页面的 URL，例如： <code>https://www.homedepot.com/s/drill</code>.</td><td>-</td></tr><tr><td><code>render</code></td><td>设为 <code>html</code>时启用 JavaScript 渲染。未启用渲染时，大多数 Home Depot 搜索请求都会失败。</td><td>-</td></tr></tbody></table>

&#x20;   \- 必需参数

## 产品 <a href="#product" id="product"></a>

### 请求示例

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

```shell
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "universal",
        "url": "https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378",
        "parse": true
    }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from pprint import pprint

# Structure payload.
payload = {
    'source': 'universal',
    'url': 'https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378',
    'parse': True
}

# Get response.
response = requests.request(
    'POST',
    'https://realtime.oxylabs.io/v1/queries',
    auth=('USERNAME', 'PASSWORD'),
    json=payload
)

# 不再返回包含任务状态和结果 URL 的响应，而是返回
# 包含结果的 JSON 响应。
pprint(response.json())
```

{% endtab %}

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

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

const username = "USERNAME";
const password = "PASSWORD";
const body = {
    source: "universal",
    url: "https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378",
    parse: true
};

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
# 提交的整个字符串必须进行 URL 编码。

https://realtime.oxylabs.io/v1/queries?source=universal&url=https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378&parse=true&access_token=12345abcde
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$params = array(
    'source' => 'universal',
    'url' => 'https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378',
    'parse' => true
);

$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": "universal",
        "url": "https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378",
        "parse": true,
    }

    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 = "universal",
                url = "https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378",
                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);
        }
    }
}
```

{% endtab %}

{% tab title="Java" %}

```java
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", "universal");
        jsonObject.put("url", "https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378");
        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();
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
    "source": "universal",
    "url": "https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378",
    "parse": true
}
```

{% endtab %}
{% endtabs %}

### 请求参数值

<table><thead><tr><th width="180">参数</th><th>说明</th><th width="160">默认值</th></tr></thead><tbody><tr><td><mark style="background-color:green;"><strong><code>source</code></strong></mark></td><td>设置抓取器。Home Depot 页面使用 <code>universal</code> 来源进行抓取。</td><td><code>universal</code></td></tr><tr><td><mark style="background-color:green;"><strong><code>url</code></strong></mark></td><td>产品页面的 URL。也可使用仅包含产品 ID 的简写形式，例如 <code>https://www.homedepot.com/p/100650378</code>。</td><td>-</td></tr><tr><td><code>parse</code></td><td>设为 <code>true</code>时返回解析后的数据。请参阅 <a href="#output-data-dictionary">输出数据字典</a>.</td><td><code>false</code></td></tr><tr><td><code>render</code></td><td>设为 <code>html</code>时启用 JavaScript 渲染。未启用渲染时，Home Depot 返回的产品页面不包含配送详情。</td><td>-</td></tr><tr><td><code>context</code>: <code>store_id</code></td><td>可选的门店本地化设置，请参阅 <a href="#localization-and-filtering">本地化与筛选</a>.</td><td>-</td></tr></tbody></table>

&#x20;   \- 必需参数

### 响应示例 <a href="#response-example" id="response-example"></a>

产品 ID 为 `100650378` 的解析后产品页面（列表缩短为一项，长值已截断）：

<details>

<summary>The Home Depot 产品响应示例</summary>

```json
{
    "results": [
        {
            "content": {
                "add_to_cart": true,
                "additional_image_urls": [
                    "https://photos-us.bazaarvoice.com/photo/2/cGhvdG86bWlsd2F1a2VldG9vbA/f84bcd2f-196a-58c8-9aec-de8e54016435"
                ],
                "answered_questions": [
                    {
                        "answer": "电池本身很轻，但对我来说，这款工具的手感重量大约是有线版本的两倍。标注的重量相近。不确定这是怎么回事。",
                        "question": "不装电池时重量是多少？"
                    }
                ],
                "answered_questions_count": 452,
                "availability": "in_stock",
                "category": {
                    "name": "密尔沃基电动工具组合套装",
                    "url": "https://www.homedepot.com/Tools-Power-Tools-Power-Tool-Combo-Kits/Milwaukee/N-5yc1vZc2ecZzv"
                },
                "category_tree": [
                    {
                        "name": "家居",
                        "url": "https://www.homedepot.com/"
                    }
                ],
                "category_urls": [
                    "https://www.homedepot.com/"
                ],
                "country_code": "US",
                "currency": "USD",
                "delivery": false,
                "description": "密尔沃基 M18 无绳锂离子双工具组合套装包含 M18 紧凑型电钻/起子机 (2606-20) 和 M18 1/4 英寸六角冲击起子机 (2...",
                "details": [
                    {
                        "name": "电池类型",
                        "value": "锂离子"
                    }
                ],
                "discontinued": false,
                "domain": "https://www.homedepot.com/",
                "features": [
                    "密尔沃基四极无框电机采用坚固设计，并结合稀土磁铁，使用寿命更长"
                ],
                "final_price": 199,
                "group_id": "100650378",
                "gtin": "0045242159338",
                "image_urls": [
                    "https://images.thdstatic.com/productImages/ed71b8cb-0cb2-4f52-ade7-f2b2e83e9c76/svn/milwaukee-power-tool-combo-kits-2691-22-64_1000.jpg"
                ],
                "in_stock": true,
                "listing_has_variations": false,
                "main_image": "https://images.thdstatic.com/productImages/ed71b8cb-0cb2-4f52-ade7-f2b2e83e9c76/svn/milwaukee-power-tool-combo-kits-2691-22-64_1000.jpg",
                "manufacturer": "密尔沃基",
                "manufacturer_description": {
                    "details": [
                        {
                            "name": "电池类型",
                            "value": "锂离子"
                        }
                    ],
                    "features": [
                        "密尔沃基四极无框电机采用坚固设计，并结合稀土磁铁，使用寿命更长"
                    ]
                },
                "model_number": "2691-22",
                "mpn": "2691-22",
                "parent_id": "337736538",
                "parse_status_code": 12000,
                "price": "$199.00",
                "product_category": "家居>工具>电动工具>电动工具组合套装>密尔沃基电动工具组合套装",
                "product_id": "100650378",
                "product_name": "M18 18V 锂离子无绳电钻起子机/冲击起子机组合套装（双工具），含两块 1.5Ah 电池、充电器和工具包",
                "rating": 4.6,
                "related_documents": [
                    {
                        "name": "安全数据表",
                        "url": "https://images.thdstatic.com/catalog/pdfImages/39/39b14438-5bf1-4568-a268-062fcb9b7c8b.pdf"
                    }
                ],
                "return_policy": "https://www.homedepot.com/c/Return_Policy",
                "return_window": 90,
                "review_count": 9253,
                "reviews": [
                    {
                        "content": "[本评论为促销活动的一部分收集。] 我有一台密尔沃基无刷电钻和充电器，还有两块 CP 2.0 M18 锂电池……",
                        "max_rating": 5,
                        "min_rating": 1,
                        "rating": 5,
                        "review_id": "402310729",
                        "title": "性价比出色，兼容旧款 M18 电池"
                    }
                ],
                "reviews_count": 9253,
                "root_category": {
                    "name": "家居",
                    "url": "https://www.homedepot.com/"
                },
                "seller_privacy_policy": "https://www.homedepot.com/privacy/privacy-and-security-statement",
                "seller_tos": "https://www.homedepot.com/c/Terms_of_Use",
                "seller_url": "https://www.homedepot.com",
                "ship_to_store": false,
                "sku": "233545",
                "star_rating": 5,
                "store_country": "US",
                "store_name": "Cumberland",
                "target_countries": [
                    "US"
                ],
                "top_reviews": [
                    {
                        "description": "[此评论是作为促销活动的一部分收集的。] 我有一台 Milwaukee 无刷电钻和充电器，配有两块 CP 2.0 M18 电池……",
                        "name": "DIY Al",
                        "rating": 5,
                        "title": "性价比出色，兼容旧款 M18 电池"
                    }
                ],
                "upc": "045242159338",
                "upcgtin13": "0045242159338",
                "url": "https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378",
                "video_count": 2,
                "warranty": {
                    "available": true,
                    "length": "5 年保修（工具），2 年保修（电池）",
                    "type": "制造商保修"
                }
            },
            "created_at": "2026-09-28 03:37:29",
            "updated_at": "2026-09-28 03:37:35",
            "page": 1,
            "url": "https://www.homedepot.com/p/Milwaukee-M18-18V-Lithium-Ion-Cordless-Drill-Driver-Impact-Driver-Combo-Kit-2-Tool-W-Two-1-5Ah-Batteries-Charger-Tool-Bag-2691-22/100650378",
            "job_id": "7510180859647894529",
            "status_code": 200,
            "is_render_forced": false,
            "parser_type": "homedepot_product"
        }
    ]
}
```

</details>

### 输出数据字典 <a href="#output-data-dictionary" id="output-data-dictionary"></a>

下表详细列出了我们解析的产品页面各元素及其说明和数据类型。表中还包含一些元数据。

<table><thead><tr><th width="254.33984375">键</th><th width="418.765625">说明</th><th width="90.078125">类型</th></tr></thead><tbody><tr><td><code>url</code></td><td>产品页面的 URL。</td><td>字符串</td></tr><tr><td><code>product_id</code></td><td>The Home Depot 产品 ID，即产品 URL 末尾的 9 位数字。</td><td>字符串</td></tr><tr><td><code>parent_id</code></td><td>该商品所属父产品的 ID。</td><td>字符串</td></tr><tr><td><code>group_id</code></td><td>产品组的 ID。</td><td>字符串</td></tr><tr><td><code>sku</code></td><td>The Home Depot 商店 SKU。</td><td>字符串</td></tr><tr><td><code>model_number</code></td><td>制造商型号。</td><td>字符串</td></tr><tr><td><code>mpn</code></td><td>制造商零件编号。</td><td>字符串</td></tr><tr><td><code>upc</code></td><td>UPC 条形码编号。</td><td>字符串</td></tr><tr><td><code>gtin</code></td><td>产品的 GTIN。</td><td>字符串</td></tr><tr><td><code>upcgtin13</code></td><td>UPC 的 13 位 GTIN 格式。</td><td>字符串</td></tr><tr><td><code>product_name</code></td><td>产品名称。</td><td>字符串</td></tr><tr><td><code>manufacturer</code></td><td>产品的品牌或制造商。</td><td>字符串</td></tr><tr><td><code>description</code></td><td>产品描述。</td><td>字符串</td></tr><tr><td><code>features</code></td><td>产品特点的项目符号列表。</td><td>数组</td></tr><tr><td><code>details</code></td><td>以名称-值对形式列出的产品规格。</td><td>数组</td></tr><tr><td><code>details.name</code></td><td>规格名称。</td><td>字符串</td></tr><tr><td><code>details.value</code></td><td>规格值。</td><td>字符串</td></tr><tr><td><code>manufacturer_description</code></td><td>重复包含制造商的 <code>details</code> 和 <code>features</code> 列表的对象。</td><td>对象</td></tr><tr><td><code>price</code></td><td>页面上显示的价格，包含货币符号，例如 <code>$199.00</code>.</td><td>字符串</td></tr><tr><td><code>final_price</code></td><td>以数字表示的价格。</td><td>浮点数</td></tr><tr><td><code>currency</code></td><td>货币的 ISO 4217 三字母代码。</td><td>字符串</td></tr><tr><td><code>availability</code></td><td>可用状态，例如 <code>in_stock</code>.</td><td>字符串</td></tr><tr><td><code>in_stock</code></td><td>指示产品是否有库存。</td><td>布尔值</td></tr><tr><td><code>discontinued</code></td><td>指示产品是否已停售。</td><td>布尔值</td></tr><tr><td><code>add_to_cart</code></td><td>指示产品是否可以加入购物车。</td><td>布尔值</td></tr><tr><td><code>delivery</code></td><td>指示是否提供配送服务。仅当页面经过渲染时才准确（<code>"render": "html"</code>）；不进行渲染时，返回 <code>false</code>.</td><td>布尔值</td></tr><tr><td><code>ship_to_store</code></td><td>指示是否提供配送至门店服务。仅当页面经过渲染时才准确（<code>"render": "html"</code>）；不进行渲染时，返回 <code>false</code>.</td><td>布尔值</td></tr><tr><td><code>shipping_cost</code> （可选）</td><td>运费列表，每种产品提供的配送方式对应一个对象： <code>ship_to_store</code>, <code>delivery</code> 或两者。页面渲染时返回（<code>"render": "html"</code>).</td><td>数组</td></tr><tr><td><code>shipping_cost.ship_to_store</code></td><td>到店自提费用： <code>shipping_price</code> （数字， <code>0</code> 免费时）和 <code>currency</code>.</td><td>对象</td></tr><tr><td><code>shipping_cost.delivery</code></td><td>送货上门费用： <code>shipping_price</code> （数字， <code>0</code> 免费时）和 <code>currency</code>.</td><td>对象</td></tr><tr><td><code>store_name</code></td><td>此页面所服务的商店名称，例如 <code>Hutchinson</code>.</td><td>字符串</td></tr><tr><td><code>zipcode</code> （可选）</td><td>该商店的邮政编码（如有显示）。</td><td>字符串</td></tr><tr><td><code>store_country</code></td><td>商店所在国家/地区。</td><td>字符串</td></tr><tr><td><code>country_code</code></td><td>网站所在国家/地区的代码。</td><td>字符串</td></tr><tr><td><code>target_countries</code></td><td>产品销售到的国家/地区列表。</td><td>数组</td></tr><tr><td><code>rating</code></td><td>产品的平均评分。</td><td>浮点数</td></tr><tr><td><code>star_rating</code></td><td>四舍五入为整数星级的评分。</td><td>整数</td></tr><tr><td><code>review_count</code></td><td>评论数量。</td><td>整数</td></tr><tr><td><code>reviews_count</code></td><td>评论数量（与 <code>review_count</code>).</td><td>整数</td></tr><tr><td><code>reviews</code></td><td>页面上显示的评论列表。</td><td>数组</td></tr><tr><td><code>reviews.review_id</code></td><td>评论的 ID。</td><td>字符串</td></tr><tr><td><code>reviews.title</code></td><td>评论标题。</td><td>字符串</td></tr><tr><td><code>reviews.content</code></td><td>评论文本。</td><td>字符串</td></tr><tr><td><code>reviews.rating</code></td><td>评论中给出的评分。</td><td>整数</td></tr><tr><td><code>reviews.min_rating</code></td><td>可能的最低评分。</td><td>整数</td></tr><tr><td><code>reviews.max_rating</code></td><td>可能的最高评分。</td><td>整数</td></tr><tr><td><code>top_reviews</code></td><td>页面上显示的精选评论列表。</td><td>数组</td></tr><tr><td><code>top_reviews.name</code></td><td>评论者姓名。</td><td>字符串</td></tr><tr><td><code>top_reviews.title</code></td><td>评论标题。</td><td>字符串</td></tr><tr><td><code>top_reviews.description</code></td><td>评论文本。</td><td>字符串</td></tr><tr><td><code>top_reviews.rating</code></td><td>评论中给出的评分。</td><td>整数</td></tr><tr><td><code>answered_questions</code></td><td>已回答的客户问题列表。</td><td>数组</td></tr><tr><td><code>answered_questions.question</code></td><td>问题。</td><td>字符串</td></tr><tr><td><code>answered_questions.answer</code></td><td>答案。</td><td>字符串</td></tr><tr><td><code>answered_questions_count</code></td><td>已回答问题的数量。</td><td>整数</td></tr><tr><td><code>main_image</code></td><td>主商品图片的 URL。</td><td>字符串</td></tr><tr><td><code>image_urls</code></td><td>商品图片 URL 列表。</td><td>数组</td></tr><tr><td><code>additional_image_urls</code></td><td>客户照片的 URL 列表。</td><td>数组</td></tr><tr><td><code>video_count</code></td><td>商品视频的数量。</td><td>整数</td></tr><tr><td><code>category</code></td><td>商品所属的类别。</td><td>对象</td></tr><tr><td><code>category.name</code></td><td>类别名称。</td><td>字符串</td></tr><tr><td><code>category.url</code></td><td>类别的 URL。</td><td>字符串</td></tr><tr><td><code>category_tree</code></td><td>从顶级类别到商品所属类别的类别列表。</td><td>数组</td></tr><tr><td><code>category_tree.name</code></td><td>类别名称。</td><td>字符串</td></tr><tr><td><code>category_tree.url</code></td><td>类别的 URL。</td><td>字符串</td></tr><tr><td><code>category_urls</code></td><td>类别路径中的类别 URL 列表。</td><td>数组</td></tr><tr><td><code>root_category</code></td><td>顶级类别。</td><td>对象</td></tr><tr><td><code>root_category.name</code></td><td>顶级类别的名称。</td><td>字符串</td></tr><tr><td><code>root_category.url</code></td><td>顶级类别的 URL。</td><td>字符串</td></tr><tr><td><code>product_category</code></td><td>完整的类别路径，以……分隔 <code>></code>.</td><td>字符串</td></tr><tr><td><code>listing_has_variations</code></td><td>指示商品是否有不同变体。</td><td>布尔值</td></tr><tr><td><code>warranty</code></td><td>包含保修信息的对象。</td><td>对象</td></tr><tr><td><code>warranty.available</code></td><td>指示是否提供保修。</td><td>布尔值</td></tr><tr><td><code>warranty.type</code></td><td>保修类型。</td><td>字符串</td></tr><tr><td><code>warranty.length</code></td><td>保修期限。</td><td>字符串</td></tr><tr><td><code>related_documents</code></td><td>商品相关文档列表，例如手册或指南。</td><td>数组</td></tr><tr><td><code>related_documents.name</code></td><td>文档名称。</td><td>字符串</td></tr><tr><td><code>related_documents.url</code></td><td>文档的 URL。</td><td>字符串</td></tr><tr><td><code>return_window</code></td><td>可退货期限（天）。</td><td>整数</td></tr><tr><td><code>return_policy</code></td><td>退货政策的 URL。</td><td>字符串</td></tr><tr><td><code>seller_url</code></td><td>卖家的 URL。</td><td>字符串</td></tr><tr><td><code>seller_tos</code></td><td>卖家的使用条款 URL。</td><td>字符串</td></tr><tr><td><code>seller_privacy_policy</code></td><td>卖家的隐私政策 URL。</td><td>字符串</td></tr><tr><td><code>domain</code></td><td>抓取该页面的网站。</td><td>字符串</td></tr><tr><td><code>parse_status_code</code></td><td>解析任务的状态代码。你可以在 <strong>此处</strong>.</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>结果分页中的页码。</td><td>整数</td></tr><tr><td><code>status_code</code></td><td>抓取页面的 HTTP 状态代码。</td><td>整数</td></tr><tr><td><code>is_render_forced</code></td><td>用于标识此请求是否强制进行渲染。</td><td>布尔值</td></tr><tr><td><code>parser_type</code></td><td>用于提取数据的解析器类型， <code>homedepot_product</code>.</td><td>字符串</td></tr><tr><td><code>job_id</code></td><td>与该抓取任务关联的任务 ID。</td><td>字符串</td></tr></tbody></table>

## 类别

### 请求示例

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

```shell
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "universal",
        "url": "https://www.homedepot.com/b/Tools-Power-Tools-Drills/N-5yc1vZc27f"
    }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from pprint import pprint

# Structure payload.
payload = {
    'source': 'universal',
    'url': 'https://www.homedepot.com/b/Tools-Power-Tools-Drills/N-5yc1vZc27f'
}

# Get response.
response = requests.request(
    'POST',
    'https://realtime.oxylabs.io/v1/queries',
    auth=('USERNAME', 'PASSWORD'),
    json=payload
)

# 不再返回包含任务状态和结果 URL 的响应，而是返回
# 包含结果的 JSON 响应。
pprint(response.json())
```

{% endtab %}

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

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

const username = "USERNAME";
const password = "PASSWORD";
const body = {
    source: "universal",
    url: "https://www.homedepot.com/b/Tools-Power-Tools-Drills/N-5yc1vZc27f"
};

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
# 提交的整个字符串必须进行 URL 编码。

https://realtime.oxylabs.io/v1/queries?source=universal&url=https://www.homedepot.com/b/Tools-Power-Tools-Drills/N-5yc1vZc27f&access_token=12345abcde
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$params = array(
    'source' => 'universal',
    'url' => 'https://www.homedepot.com/b/Tools-Power-Tools-Drills/N-5yc1vZc27f'
);

$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": "universal",
        "url": "https://www.homedepot.com/b/Tools-Power-Tools-Drills/N-5yc1vZc27f",
    }

    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 = "universal",
                url = "https://www.homedepot.com/b/Tools-Power-Tools-Drills/N-5yc1vZc27f"
            };

            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.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", "universal");
        jsonObject.put("url", "https://www.homedepot.com/b/Tools-Power-Tools-Drills/N-5yc1vZc27f");

        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": "universal",
    "url": "https://www.homedepot.com/b/Tools-Power-Tools-Drills/N-5yc1vZc27f"
}
```

{% endtab %}
{% endtabs %}

### 请求参数值

<table><thead><tr><th width="96">参数</th><th width="553">说明</th><th width="113">默认值</th></tr></thead><tbody><tr><td><mark style="background-color:green;"><strong><code>source</code></strong></mark></td><td>设置抓取器。Home Depot 页面使用 <code>universal</code> 来源进行抓取。</td><td><code>universal</code></td></tr><tr><td><mark style="background-color:green;"><strong><code>url</code></strong></mark></td><td>类别页面的 URL，例如 <code>https://www.homedepot.com/b/Tools-Power-Tools-Drills/N-5yc1vZc27f</code>.</td><td>-</td></tr></tbody></table>

&#x20;   \- 必需参数

## 本地化与筛选 <a href="#localization-and-filtering" id="localization-and-filtering"></a>

<table><thead><tr><th width="103.66796875">参数</th><th width="88.19140625">适用于</th><th width="485.5">说明</th><th width="83.234375">默认值</th></tr></thead><tbody><tr><td><code>context</code>: <code>store_id</code></td><td>商品页面</td><td>Home Depot 门店编号，以 4 位数字字符串表示。请在 <a href="https://www.homedepot.com/l/storeDirectory">Home Depot 门店目录</a>中查找门店；编号是门店页面 URL 的最后一部分，例如 <code>homedepot.com/l/21st-South/UT/Salt-Lake-City/84115/</code><strong><code>4403</code></strong>。对于 3 位数编号，请在前面加一个零，例如 121 → <code>"0121"</code>。解析出的 <code>store_name</code> 会显示页面对应的门店。不要与 <code>render</code>.</td><td>-</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/dian-zi-shang-wu/the-home-depot.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
