# 分页查询

本文档提供了如何使用分页参数向 SERP API 发送 GET 请求并解释响应的示例。

### 带分页的API请求[​](https://serp-api.netnut.io/docs/SERP/API%20Examples/Query%20with%20Pagination#api-request-with-pagination) <a href="#api-request-with-pagination" id="api-request-with-pagination"></a>

要向 SERP API 发送 GET 请求以进行分页的新闻相关查询，您可以使用以下命令：

* Bash
* Javascript
* Python
* Go

```
curl -L 'https://serp-api.netnut.io/search?device=desktop&q=news&num=10&start=10' \
-H 'Accept: application/json' \
-H 'Authorization: Basic base64(username:password)'
```

在此请求中，我们添加了两个分页参数：

* num：此可选参数定义结果偏移量，跳过给定数量的结果。 它用于分页。 例如，num=10 将跳过前 10 个结果。
* start：此可选参数定义要返回的最大结果数。 例如，要返回第二页，start=10 将从第 11 个结果开始返回 10 个结果。

### API 响应 <a href="#api-response" id="api-response"></a>

API 将返回一个 JSON 对象，其中包含指定分页参数的搜索结果。以下是第二页结果的响应示例（跳过前 10 个结果）：

在响应中，您将看到 currentPage 指示当前结果页，nextPage 和 nextPageLink 提供有关下一页结果的信息。nextPageStart 参数指定下一页结果的起始位置。

范例演示了如何在 SERP API 中使用 num 和 start 参数进行分页。您可以在 GET 请求中调整这些参数以检索所需的结果页面。

```
{
    "url": "https://www.google.com/search?q=news&num=10&start=10",
    "general": {
        "searchEngine": "google",
        "resultsCount": 25270000000,
        "searchTime": 0.38,
        "mobile": false,
        "searchType": "text",
        "pageTitle": "news - Google Search",
        "timestamp": "2023-10-01T12:21:09.363Z"
    },
    "input": {
        "originalUrl": "https://www.google.com/search?q=news&num=10&start=10",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
        "jobId": "3282d83a-7ec9-4a51-b49f-107519ea5f5a"
    },
    "organic": [
        {
            "title": "Yahoo News - Latest News & Headlines",
            "description": "7 hours ago — The latest news and headlines from Yahoo! News. Get breaking news stories and in-depth coverage with videos and photos.",
            "link": "https://news.yahoo.com/",
            "displayLink": "https://news.yahoo.com",
            "rank": 1,
            "globalRank": 1
        },
        {
            "title": "U.S. and World News Headlines",
            "description": "7 minutes ago — NPR news, audio, and podcasts. Coverage of breaking stories, national and world news, politics, business, science, technology, and extended coverage of ...",
            "link": "https://www.npr.org/sections/news/",
            "displayLink": "https://www.npr.org › sections › news",
            "rank": 2,
            "globalRank": 2
        },
        {
            "title": "Home - BBC News",
            "description": "Visit BBC News for up-to-the-minute news, breaking news, video, audio and feature stories. BBC News provides trusted World and UK news as well as local and ...",
            "link": "https://www.bbc.com/news",
            "displayLink": "https://www.bbc.com › news",
            "rank": 3,
            "globalRank": 3
        },
        {
            "title": "6abc Action News - WPVI Philadelphia, Pennsylvania, New ...",
            "description": "5 hours ago — Action News and 6abc.com are Philadelphia's source for breaking news, weather and video, covering Philadelphia, Pa., NJ, and Delaware.",
            "link": "https://6abc.com/",
            "displayLink": "https://6abc.com",
            "rank": 4,
            "globalRank": 4
        },
        {
            "title": "Reuters | Breaking International News & Views",
            "description": "4 hours ago — Find latest news from every corner of the globe at Reuters.com, your online source for breaking international news coverage.",
            "link": "https://www.reuters.com/",
            "displayLink": "https://www.reuters.com",
            "rank": 5,
            "globalRank": 5
        },
        {
            "title": "FOX 29 News Philadelphia",
            "description": "9 hours ago — Philadelphia news, weather, traffic and sports from FOX 29, serving Pennsylvania, New Jersey and Delaware. Watch breaking news live or see the latest videos ...",
            "link": "https://www.fox29.com/",
            "displayLink": "https://www.fox29.com",
            "rank": 6,
            "globalRank": 6
        },
        {
            "title": "Inquirer.com: Philadelphia local news, sports, jobs, cars, homes",
            "description": "6 hours ago — Keep reading by creating a free account or signing in. Sign in/Sign up; Subscribe; Support local news.",
            "link": "https://www.inquirer.com/",
            "displayLink": "https://www.inquirer.com",
            "rank": 7,
            "globalRank": 7
        },
        {
            "title": "The Washington Post - Breaking news and latest headlines ...",
            "description": "6 hours ago — Breaking news, live coverage, investigations, analysis, video, photos and opinions from The Washington Post. Subscribe for the latest on U.S. and ...",
            "link": "https://www.washingtonpost.com/",
            "displayLink": "https://www.washingtonpost.com",
            "rank": 8,
            "globalRank": 8
        },
        {
            "title": "UN News | Global perspective Human stories",
            "description": "UN News produces daily news content in Arabic, Chinese, English, French ... news features and analyses on a variety of social, political, economic ...",
            "link": "https://news.un.org/en/",
            "displayLink": "https://news.un.org › ...",
            "rank": 9,
            "globalRank": 9
        },
        {
            "title": "The New York Times - Breaking News, US News, World News ...",
            "description": "11 hours ago — Live news, investigations, opinion, photos and video by the journalists of The New York Times from more than 150 countries around the world.",
            "link": "https://www.nytimes.com/",
            "displayLink": "https://www.nytimes.com",
            "rank": 10,
            "globalRank": 10
        }
    ]
}
```

[<br>](https://serp-api.netnut.io/docs/SERP/API%20Examples/Query)


---

# 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://help.netnut.io/netnut-documentation/netnut-documentation-chn/netnut-zhua-qu-api/sou-suo-jie-guo-ye-mian-serp-api/api-shi-fan/fen-ye-cha-xun.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.
