> 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/best-sellers.md).

# 畅销商品

使用网页爬虫API 探索 Amazon 畅销商品数据。通过可自定义参数收集排名靠前的产品详情、类别和价格。

该 `amazon_bestsellers` 数据源旨在检索 Amazon Best Sellers 页面。要查看带有检索数据的响应示例，请下载此 [**示例输出**](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiwDdoZGfMbUe5cRL2417%2Fuploads%2Frf2S2YKKlEEhu4cCoW6b%2Famazon_bestsellers.json?alt=media\&token=6b4b3817-5a6e-4095-96b0-81d8d9d0883f) HTML 格式文件，或查看结构化数据输出 [**这里**](#structured-data).

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

## 请求示例

在下面的代码示例中，我们发出请求以检索 `2`类别中 Best Sellers 的第 nd 页，其 ID 为 `172541`，在 `amazon.com` 市场。

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

```bash
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "amazon_bestsellers",
        "domain": "com", 
        "query": "172541", 
        "render": "html",
        "start_page": 2, 
        "parse": true
    }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from pprint import pprint


# Structure payload.
payload = {
    'source': 'amazon_bestsellers',
    'domain': 'com',
    'query': '172541',
    'render': 'html',
    'start_page': 2,
    'parse': True,
}


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

# Print prettified response to stdout.
pprint(response.json())
```

{% endtab %}

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

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

const username = "USERNAME";
const password = "PASSWORD";
const body = {
    source: "amazon_bestsellers",
    domain: "com",
    query: "172541",
    render: "html",
    start_page: 2, 
    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
https://realtime.oxylabs.io/v1/queries?source=amazon_bestsellers&domain=com&query=172541&render=html&start_page=2&parse=true&access_token=12345abcde
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$params = array(
    'source' => 'amazon_bestsellers',
    'domain' => 'com',
    'query' => '172541',
    'render' => 'html',
    'start_page' => 2, 
    '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_bestsellers",
		"domain":     "com",
		"query":      "172541",
		"render":     "html",
		"start_page": 2,
		"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 = {
                source = "amazon_bestsellers",
                domain = "com",
                query = "172541",
                render = "html",
                start_page = 2,
                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_bestsellers");
        jsonObject.put("domain", "com");
        jsonObject.put("query", "172541");
        jsonObject.put("render", "html");
        jsonObject.put("start_page", 2);
        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_bestsellers",
    "domain": "com",
    "query": "172541",
    "render": "html",
    "start_page": 2,
    "parse": true
}
```

{% endtab %}
{% endtabs %}

我们在示例中使用同步 [**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) 部分。

## 请求参数值

### 通用

用于抓取 Amazon Best Sellers 页面的基础设置和自定义选项。

<table><thead><tr><th width="222">参数</th><th width="309.3333333333333">说明</th><th>默认值</th></tr></thead><tbody><tr><td><mark style="background-color:green;"><strong>source</strong></mark></td><td>设置爬虫。</td><td><code>amazon_bestsellers</code></td></tr><tr><td><mark style="background-color:green;"><strong>query</strong></mark></td><td>浏览节点 ID（商品类别 ID）</td><td>-</td></tr><tr><td><mark style="background-color:green;"><strong>render</strong></mark></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>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="/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).                                 | -     |
| `domain`       | Amazon 的域本地化。可用域的完整列表可见 [**这里**](https://github.com/oxylabs/gitbook-public-english/blob/master/scraping-solutions/web-scraper-api/targets/amazon/broken-reference/README.md). | `com` |
| `locale`       | `Accept-Language` 头值，用于设置 Amazon 页面界面语言。 [**更多信息**](/products/cn/web-scraper-api/features/localization/domain-locale.md#amazon).                                              | -     |

{% hint style="warning" %}
**重要：** 在大多数页面类型中，Amazon 会根据客户的配送地址定制返回结果。因此，我们建议使用 `geo_location` 参数来设置你偏好的配送地址。你可以阅读更多关于如何使用 `geo_location` 与 Amazon 配合使用 [**这里**](https://github.com/oxylabs/gitbook-public-english/blob/master/scraping-solutions/web-scraper-api/targets/amazon/broken-reference/README.md).
{% endhint %}

### 分页

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

<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>

### 其他

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

| 参数                                                    | 说明                                                                                                                                                                                                                         | 默认值                                                                                                                                                                                                                         |
| ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>context</code>:<br><code>currency</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). |

#### 代码示例

```json
{
    "source": "amazon_bestsellers",
    "domain": "com",
    "query": "172541",
    "parse": true,
    "context": [
        {
            "key": "currency",
            "value": "AUD"
        }
    ]
}
```

## 结构化数据

下面可以找到一个 **结构化输出示例** 适用于 `amazon_bestsellers`.

<details>

<summary><code>Amazon_bestsellers</code> <strong>输出示例</strong></summary>

```json
{
    "results": [
        {
            "content": {
                "url": "https://www.amazon.com/Best-Sellers/zgbs/x/172541/?pg=2&language=en_US",
                "page": 2,
                "pages": 2,
                "query": "172541",
                "results": [
                    {
                        "asin": "B0DHVH5KCB",
                        "currency": "USD",
                        "image_url": "https://images-na.ssl-images-amazon.com/images/I/61gDMS2fowL._AC_UL300_SR300,200_.jpg",
                        "pos": 1,
                        "price": 26.98,
                        "price_str": "$26.98",
                        "price_upper": 0,
                        "rating": 4.3,
                        "ratings_count": 45795,
                        "title": "TOZO OpenEarRing Open Ear Earbuds 40H Bluetooth 5.4 Lightweight Comfort | Open Ear Clip On Wireless Earbuds with Smart Digita",
                        "url": "/TOZO-OpenEarRing-Headphones-Lightweight-Bluetooth/dp/B0DHVH5KCB/ref=zg_bs_g_172541_d_sccl_1/146-2258288-8619300?psc=1"
                    },
                    {
                        "asin": "B0CRT6HQ82",
                        "currency": "USD",
                        "image_url": "https://images-na.ssl-images-amazon.com/images/I/51dhkN5TYiL._AC_UL300_SR300,200_.jpg",
                        "pos": 2,
                        "price": 69.99,
                        "price_str": "$69.99",
                        "price_upper": 0,
                        "rating": 4.1,
                        "ratings_count": 15954,
                        "title": "Soundcore Sport X20 by Anker Noise Cancelling Workout Earbuds, Ear Hooks | Rotatable and Extendable Ear Hooks, Deep Bass, IP6",
                        "url": "/Soundcore-True-Wireless-Extendable-Cancelling-Waterproof/dp/B0CRT6HQ82/ref=zg_bs_g_172541_d_sccl_2/146-2258288-8619300?psc=1"
                    },
                    {
                        "asin": "B07MCND66X",
                        "currency": "USD",
                        "image_url": "https://images-na.ssl-images-amazon.com/images/I/71IU1VGw0FL._AC_UL300_SR300,200_.jpg",
                        "pos": 3,
                        "price": 12.99,
                        "price_str": "$12.99",
                        "price_upper": 0,
                        "rating": 4.4,
                        "ratings_count": 10614,
                        "title": "适合学校使用的儿童耳机，带麦克风，93dB 音量限制，粉紫色 | 适合女孩和男孩的有线入耳式耳机，可折叠",
                        "url": "/AILIHEN-Headphones-Microphone-Lightweight-Cellphones/dp/B07MCND66X/ref=zg_bs_g_172541_d_sccl_3/146-2258288-8619300?psc=1"
                    },
                    ...
                ],
                "parse_status_code": 12000
            },
            "created_at": "2026-09-17 13:45:24",
            "updated_at": "2026-09-17 13:45:47",
            "page": 2,
            "url": "https://www.amazon.com/Best-Sellers/zgbs/x/172541/?pg=2&language=en_US",
            "job_id": "7506347579148356609",
            "is_render_forced": false,
            "status_code": 200,
            "parser_type": "",
            "parser_preset": null
        }
    ]
}
```

</details>

## 数据字典

#### HTML 示例

<figure><img src="https://1830353461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBaJCXoqO1zdFnaMnCKrg%2Fuploads%2Fgit-blob-a74c48b93b275d9cfde2e5c15ea3512aa176aab7%2Famazon_best_sellers.png?alt=media" alt=""><figcaption></figcaption></figure>

#### JSON 结构

该 `amazon_bestsellers` 提供有关 Amazon 上畅销产品的全面数据。下表展示了我们解析的每个字段的详细列表，以及其描述和数据类型。表中还包括一些元数据。

<table><thead><tr><th width="239">键</th><th width="364">说明</th><th>类型</th></tr></thead><tbody><tr><td><code>url</code></td><td>Amazon 畅销榜页面的 URL。</td><td>字符串</td></tr><tr><td><code>page</code></td><td>当前页码。</td><td>整数</td></tr><tr><td><code>pages</code></td><td>总页数。</td><td>整数</td></tr><tr><td><code>query</code></td><td>原始搜索词。</td><td>字符串</td></tr><tr><td><code>results</code></td><td>包含搜索结果的字典。</td><td>对象</td></tr><tr><td><code>results.pos</code></td><td>表示畅销商品位置的指标。</td><td>整数</td></tr><tr><td><code>results.url</code></td><td>畅销商品的 URL。</td><td>字符串</td></tr><tr><td><code>results.asin</code></td><td>Amazon 标准识别号。</td><td>字符串</td></tr><tr><td><code>results.price</code></td><td>产品价格。</td><td>字符串</td></tr><tr><td><code>results.title</code></td><td>产品标题。</td><td>字符串</td></tr><tr><td><code>results.rating</code></td><td>产品评分。</td><td>浮点数</td></tr><tr><td><code>results.currency</code></td><td>价格所使用的货币。</td><td>字符串</td></tr><tr><td><code>results.is_prime</code></td><td>指示该产品是否符合 Amazon Prime 资格。</td><td>布尔值</td></tr><tr><td><code>results.price_str</code></td><td>任何折扣或促销前的原始价格</td><td>浮点数</td></tr><tr><td><code>results.price_upper</code></td><td>如果适用，价格上限。</td><td>浮点数</td></tr><tr><td><code>results_ratings_count</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/amazon/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>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/amazon/broken-reference/README.md"><strong>这里</strong></a>.</td><td>整数</td></tr><tr><td><code>parser_type</code></td><td>用于解析数据的解析器类型。</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 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/best-sellers.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.
