> 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/api-targets/cn/e-commerce/amazon/url.md).

# URL

使用网页爬虫API 按 URL 抓取 Amazon 页面。文档涵盖请求示例、解析后的输出、JS 渲染、地理定位和用户代理选项。

该 `amazon` source 旨在从各种 Amazon URL 中检索内容。这意味着，你无需发送多个参数，只需向我们提供所需 Amazon 页面 的直接 URL。我们不会移除任何参数，也不会以其他方式更改你的 URL。

## 请求示例

在下面的代码示例中，我们发送请求以检索 ASIN 的 Amazon 商品页面 `B08Y6Z944Q`.

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

```shell
curl 'https://realtime.oxylabs.io/v1/queries' \\
--user 'USERNAME:PASSWORD' \\
-H 'Content-Type: application/json' \\
-d '{
        "source": "amazon", 
        "url": "https://www.amazon.co.uk/dp/B08Y6Z944Q/",
        "parse": true
    }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from pprint import pprint


# 结构化载荷。
payload = {
    'source': 'amazon',
    'url': 'https://www.amazon.co.uk/dp/B08Y6Z944Q/',
    'parse': True
}

# 获取响应。
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: "amazon",
    url: "https://www.amazon.co.uk/dp/B08Y6Z944Q/",
    解析：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
https://realtime.oxylabs.io/v1/queries?source=amazon&url=https%3A%2F%2Fwww.amazon.co.uk%2Fdp%2FB08Y6Z944Q%2F&parse=true&access_token=12345abcde
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$params = array(
    'source' => 'amazon',
    'url' => 'https://www.amazon.co.uk/dp/B08Y6Z944Q/',
    '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": "amazon",
		"url":    "https://www.amazon.co.uk/dp/B08Y6Z944Q/",
		"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 = "amazon",
                url = "https://www.amazon.co.uk/dp/B08Y6Z944Q/",
                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", "amazon");
        jsonObject.put("url", "https://www.amazon.co.uk/dp/B08Y6Z944Q/");
        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": "amazon", 
    "url": "https://www.amazon.co.uk/dp/B08Y6Z944Q/",
    "parse": true
}
```

{% endtab %}
{% endtabs %}

<details>

<summary>输出示例</summary>

```json
{
    "results": [
        {
            "content": {
                "ads": [
                    {
                        "pos": 1,
                        "asin": "B0CH3JJN66",
                        "type": "organic_also_viewed",
                        "price": 375,
                        "title": "三星 55 英寸 AU7020 UHD HDR 4K 智能电视（2023）- Crystal UHD 4K 智能电视，配备 HDR 画质、Adaptive Sound Lite、PurColour ",
                        "images": [
                            "https://m.media-amazon.com/images/I/71Dxs5msCcL._AC_SS57_.jpg",
                            "https://m.media-amazon.com/images/I/61rH38KyMnL.jpg",
                            "https://m.media-amazon.com/images/I/71xvR9thu1L.jpg"
                        ],
                        "rating": 4.5,
                        "location": "carousel",
                        "price_upper": 375,
                        "reviews_count": 45,
                        "is_prime_eligible": true
                    },
                    {
                        "pos": 2,
                        "asin": "B0BW9RPQPW",
                        "type": "organic_also_viewed",
                        "price": 362,
                        "title": "50 英寸 CU7110 UHD HDR 智能电视（2023）- 4K Crystal Processor、Adaptive Sound Audio、PurColour、内置 Gaming TV Hub、Strea",
                        "images": [
                            "https://m.media-amazon.com/images/I/81eKwOlfhTL._AC_SS57_.jpg",
                            "https://m.media-amazon.com/images/I/619tbh+PSSL.jpg",
                            "https://m.media-amazon.com/images/I/81iuMoHZWhL.jpg"
                        ],
                        "rating": 4.5,
                        "location": "carousel",
                        "price_upper": 362,
                        "reviews_count": 45,
                        "is_prime_eligible": true
                    },
                    {...}
                ],
                "url": "https://www.amazon.co.uk/dp/B08Y6Z944Q/",
                "asin": "B08Y6Z944Q",
                "page": 1,
                "brand": "三星",
                "price": 0,
                "stock": "",
                "title": "三星 AU7100 50 英寸（2021）– Crystal 4K 智能电视，支持 HDR10+ 图像质量、Adaptive Sound、Motion Xcelerator 画面、三星 Q-Symphony 音频和 Gaming Mode - UE50AU7100KXXU",
                "coupon": "",
                "images": [
                    "https://m.media-amazon.com/images/I/71Urp17dnYL._AC_SL1500_.jpg",
                    ...
                    "https://m.media-amazon.com/images/I/51yb9wscZTL._AC_SL1500_.jpg"
                ],
                "rating": 4.5,
                "category": [
                    {
                        "ladder": [
                            {
                                "url": "/tv-bluray-dvd-home-cinema/b/ref=dp_bc_aui_C_1?ie=UTF8&node=560858",
                                "name": "家庭影院、电视与视频"
                            },
                            {
                                "url": "/LED-Smart-4K-TVs/b/ref=dp_bc_aui_C_2?ie=UTF8&node=560864",
                                "name": "电视"
                            }
                        ]
                    }
                ],
                "currency": "GBP",
                "delivery": [],
                "_warnings": [
                    "无法解析价格数量。",
                    "无法解析价格。",
                    "无法解析描述。"
                ],
                "page_type": "商品",
                "price_sns": 0,
                "variation": [
                    {
                        "asin": "B08Y7182XL",
                        "selected": false,
                        "dimensions": {
                            "Size Name": "85\""
                        }
                    },
                    {
                        "asin": "B08Y733RV1",
                        "selected": false,
                        "dimensions": {
                            "Size Name": "43\""
                        }
                    },
                    {...}
                ],
                "has_videos": true,
                "sales_rank": [
                    {
                        "rank": 28405,
                        "ladder": [
                            {
                                "url": "/gp/bestsellers/electronics/ref=pd_zg_ts_electronics",
                                "name": "电子与摄影"
                            }
                        ]
                    },
                    {
                        "rank": 479,
                        "ladder": [
                            {
                                "url": "/gp/bestsellers/electronics/560864/ref=pd_zg_hrsr_electronics",
                                "name": "电视"
                            }
                        ]
                    }
                ],
                "top_review": "这台电视性价比很高，画面非常出色，尤其是在流媒体服务上，而这也是我们大多数时间的观看方式。我先在网上读了很多专业评测，评分都很高，结果也没有让我失望。需要进行不少设置，我还调整了一些选项才能获得最佳画质。一开始画面太暗，尤其是在 Amazon Prime 上。看来这是 Prime 上的一个特定问题。关闭 \"Brightness Optimisation\" 后，画质明显改善。我们也不喜欢 4K LED 电视带来的 \"ultra real\" 效果。切换到 \"Filmmaker Mode\" 后就解决了。音质还可以，不过我们本来就会用 soundbar。我尤其喜欢电视附带的两个遥控器。一个是传统遥控器，按键很多：我一开始就是用它完成所有设置的，包括控制 BluRay 播放器和 soundbar。等一切都正常后，我换成了更小的遥控器，它只有最必要的按键，但外观和手感更精致，按键的 \"click\" 感也比大遥控器更好。看地面电视也没问题，只是没有流媒体服务那么好。我们不玩游戏，所以无法评价游戏方面的表现。总的来说，这是一台很棒、很划算的电视。\n  \n阅读更多",
                "asin_in_url": "B08Y6Z944Q",
                "description": "",
                "parent_asin": "B09DLFS6JN",
                "price_upper": 0,
                "pricing_str": "",
                "pricing_url": "https://www.amazon.co.uk/gp/offer-listing/B08Y6Z944Q?startIndex=0",
                "manufacturer": "三星",
                "price_buybox": -1,
                "product_name": "三星 AU7100 50 英寸（2021）– Crystal 4K 智能电视，支持 HDR10+ 图像质量、Adaptive Sound、Motion Xcelerator 画面、三星 Q-Symphony 音频和 Gaming Mode - UE50AU7100KXXU",
                "bullet_points": "AU7100 带来家庭娱乐卓越体验——这是一款能满足一切需求的智能超高清电视，三星 50 英寸 AU7100 智能电视融合震撼画质、鲜艳色彩、清晰音频和醒目的纤薄设计，提升你的居住空间。\n通过惊艳的 4K 画质获得强劲表现——你的 50 英寸智能电视配备 Dynamic Crystal Colour 和 Contrast Enhancer，因此你可以以惊艳的 4K 细节观看所有喜爱的节目，色彩更鲜明，对比度让画面更清晰。\n在电视上体验 Adaptive Sound 带来的音效完美——你的三星电视会根据屏幕内容在每个场景中调整声音，让你仿佛置身其中。添加三星 soundbar 后，Q-Symphony 可带来影院般体验。\n用三星电视升级你的办公设置，或直接投入游戏——PC on TV 可让你从智能电视远程访问办公室电脑，让你在客厅就能完成所有操作。我们的智能电视还提供沉浸式游戏模式。\n开始体验三星电视——我们认为电视不只是让你观看的东西。它应该激发灵感、令人惊叹、包裹并沉浸你。从出色画质到优雅设计，我们的电视不断突破电视与可能性的边界。",
                "price_initial": 0,
                "pricing_count": 1,
                "reviews_count": 2067,
                "sns_discounts": [],
                "developer_info": [],
                "price_shipping": 0,
                "product_details": {
                    "asin": "B08Y6Z944Q",
                    "batteries": "需要 2 节 AAA 电池。（已包含）",
                    "manufacturer": "三星",
                    "item_model_number": "UE50AU7100KXXU",
                    "product_dimensions": "5.99 x 111.68 x 64.42 cm; 11.4 kg",
                    "date_first_available": "2021 年 3 月 2 日"
                },
                "featured_merchant": [],
                "is_prime_eligible": false,
                "parse_status_code": 12005,
                "product_dimensions": "5.99 x 111.68 x 64.42 cm; 11.4 kg",
                "answered_questions_count": 0,
                "rating_stars_distribution": [
                    {
                        "rating": 5,
                        "percentage": 74
                    },
                    {
                        "rating": 4,
                        "percentage": 15
                    },
                    {...}
                ]
            },
            "created_at": "2024-07-01 10:35:28",
            "updated_at": "2024-07-01 10:35:32",
            "page": 1,
            "url": "https://www.amazon.co.uk/dp/B08Y6Z944Q/",
            "job_id": "7213490386797350913",
            "status_code": 200,
            "parser_type": ""
        }
    ]
}
```

</details>

我们在示例中使用同步 [**Realtime**](/products/cn/web-scraper-api/integration-methods/realtime.md) 集成方法。如果您想使用 [**Proxy Endpoint**](/products/cn/web-scraper-api/integration-methods/proxy-endpoint.md) 或异步 [**Push-Pull**](/products/cn/web-scraper-api/integration-methods/push-pull.md) 集成，请参阅 [**集成方法**](/products/cn/web-scraper-api/integration-methods.md) 部分。

## 请求参数值

### 通用

Google URL 抓取的基本设置和自定义选项。

<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>amazon</code></td></tr><tr><td><mark style="background-color:green;"><strong>url</strong></mark></td><td>指向 Amazon 页面的直接 URL（链接）</td><td>-</td></tr><tr><td><code>render</code></td><td>设置为时启用 JavaScript 渲染 <code>html</code>. <a href="/products/cn/web-scraper-api/features/js-rendering-and-browser-control.md#javascript-rendering"><strong>更多信息</strong></a><strong>.</strong></td><td>-</td></tr><tr><td><code>解析</code></td><td>设置为以下值时返回解析后的数据： <code>true</code><strong>.</strong> 仅限于特定的 URL <a href="/products/cn/web-scraper-api/features/custom-parser.md"><strong>Amazon 页面类型</strong></a>.</td><td><code>false</code></td></tr><tr><td><code>callback_url</code></td><td>回调端点的 URL。 <a href="/products/cn/web-scraper-api/integration-methods/push-pull.md"><strong>更多信息</strong></a>.</td><td>-</td></tr><tr><td><code>user_agent_type</code></td><td>设备类型和浏览器。完整列表可在 <a href="/products/cn/web-scraper-api/features/http-context-and-job-management/user-agent-type.md"><strong>此处</strong></a>.</td><td><code>desktop</code></td></tr></tbody></table>

\- 必填参数

### 本地化

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

| 参数             | 描述                                                                                                                                               | 默认值 |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | --- |
| `geo_location` | 该 *配送至* 位置。请参阅我们关于使用此参数的指南 [**此处**](/products/cn/web-scraper-api/features/localization/proxy-location.md#list-of-supported-geo_location-values). | -   |
| `locale`       | `Accept-Language` header 值，用于设置 Amazon 页面的界面语言。 [**更多信息**](/products/cn/web-scraper-api/features/localization/domain-locale.md#amazon).          | -   |

{% hint style="warning" %}
**重要：** 在大多数页面类型上，Amazon 会根据客户的配送位置定制返回结果。因此，我们建议使用 `geo_location` 参数来设置你偏好的配送位置。你可以阅读更多关于使用 `geo_location` 与 Amazon 配合使用 [**此处**](broken://pages/8931e43529976f20d349248bd18bb7ad8c63a051).
{% endhint %}

### 其他

针对特殊需求的其他高级设置和控件。

| 参数                                              | 描述                                                                                                                                                                                                                         | 默认值                                                                                                                                                                                                                         |
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>context</code>:<br><code>货币</code></p> | 设置货币。查看可用值 [**此处**](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzrXw45naRpCZ0Ku9AjY1%2Fuploads%2FNNybEQaVnTrc9ymR1NGE%2Fcurrency_new.json?alt=media\&token=a77440f9-50a5-4e07-9993-b2db2144800b). | 取决于市场。查看默认值 [**此处**](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzrXw45naRpCZ0Ku9AjY1%2Fuploads%2FNNybEQaVnTrc9ymR1NGE%2Fcurrency_new.json?alt=media\&token=a77440f9-50a5-4e07-9993-b2db2144800b). |


---

# 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 dynamically by asking a question.

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

```
GET https://developers.oxylabs.io/api-targets/cn/e-commerce/amazon/url.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
