# URL

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

## 请求样本

在下面的代码示例中，我们发起请求以检索 ASIN 为 `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/",
    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);
});

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 '错误:' . 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("错误： " + 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、内置游戏电视中心、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） \u00e2\u20ac\u201c Crystal 4K 智能电视，具备 HDR10+ 图像质量、Adaptive Sound、Motion Xcelerator 画面、三星 Q-Symphony 音频和游戏模式 - 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 电视带来的 \"超真实\" 效果。切换到 \"Filmmaker Mode\" 解决了这个问题。音质还可以，不过我们反正也使用音响条。我特别喜欢电视附带的两个遥控器。还有一个传统遥控器，按键很多：我一开始用它来完成所有设置，包括控制蓝光播放器和音响条。等一切都正常工作后，我改用较小的遥控器，它只有最基本的按键，但外观和手感更精致，按键的 \"点击\" 反馈也比大号遥控器更好。看地面数字电视也不错，只是没有流媒体服务那么好。我们不是游戏玩家，所以无法评价它在这方面的表现。总之，这是一台很棒的电视，而且价格划算。\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） \u00e2\u20ac\u201c Crystal 4K 智能电视，具备 HDR10+ 图像质量、Adaptive Sound、Motion Xcelerator 画面、三星 Q-Symphony 音频和游戏模式 - UE50AU7100KXXU",
                "bullet_points": "AU7100 让家庭娱乐更出色——这是一款智能超高清电视，集一切于一身。三星 50 英寸 AU7100 智能电视将惊艳画面、生动色彩、清晰音效和纤薄优雅的设计融为一体，提升您的生活空间。\n以惊艳 4K 呈现强大画质——您的 50 英寸智能电视配备 Dynamic Crystal Colour 和 Contrast Enhancer，因此您可以以令人惊叹的 4K 细节观看所有喜爱的节目，色彩鲜明，对比度带来更清晰的画面。\n通过电视上的 Adaptive Sound 体验音效完美——您的三星电视会根据屏幕上的内容，在每个场景中调整声音，让您仿佛身临其境。添加三星音响条后，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 厘米；11.4 公斤",
                    "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 厘米；11.4 公斤",
                "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,
            数据字典
        }
    ]
}
```

</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="/spaces/ZwEHB9k4MH4pDy80n9mF/pages/9d7133837001de31de5dfd0796cfbc6fdd7c78c8#javascript-rendering"><strong>更多信息</strong></a><strong>.</strong></td><td>-</td></tr><tr><td><code>parse</code></td><td>设置为时返回解析后的数据 <code>true</code><strong>.</strong> 仅限特定的 URL <a href="/spaces/ZwEHB9k4MH4pDy80n9mF/pages/0c3e507c4698b170bfbc4b7626d0ac92df840637"><strong>Amazon 页面类型</strong></a>.</td><td><code>false</code></td></tr><tr><td><code>callback_url</code></td><td>回调端点的 URL。 <a href="/spaces/ZwEHB9k4MH4pDy80n9mF/pages/f93fe40aed5366f8033cd2ebfae30e61c16a4f51"><strong>更多信息</strong></a>.</td><td>-</td></tr><tr><td><code>user_agent_type</code></td><td>设备类型和浏览器。完整列表可在 <a href="/spaces/ZwEHB9k4MH4pDy80n9mF/pages/3e6a8ee6a2915a55b276cc31a20735fe1e0e4ed1"><strong>这里</strong></a>.</td><td><code>desktop</code></td></tr></tbody></table>

&#x20;   \- 必填参数

### 本地化

根据特定地理位置和语言调整结果。

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

{% hint style="warning" %}
**重要：** 在大多数页面类型中，Amazon 会根据客户的配送地点定制返回结果。因此，我们建议使用 `geo_location` 参数来设置您偏好的配送地点。您可以阅读更多关于如何在 Amazon 中使用 `geo_location` 的内容 [**这里**](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: 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/api-targets/cn/dian-zi-shang-wu/amazon/url.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.
