# Introduction to Baidu Search Scraper

This document provides information about the API endpoints, supported environments, and available GET parameters for the NetNut's Baidu Scraper API. \
The API allows you to retrieve search engine results pages (SERPs) from Baidu.

### Authentication[​](https://serp-api.netnut.io/docs/SERP/Getting%20Started#authentication) <a href="#authentication" id="authentication"></a>

To access the NetNut API, you must provide basic authentication credentials using the username and password provided by NetNut. Include these credentials in the HTTP request headers as follows:

`Authorization: Basic base64(username:password)`

Where `base64(username:password)` is the Base64-encoded string of your username and password concatenated with a colon (:) separator.

### Environments

Base URL: `https://serp-api.netnut.io`\
Endpoint: `/search/get-html?`

The following parameters are supported when retrieving Baidu SERPs via the API. To target Baidu specifically, **you must include the parameter `siteType=baidu` in your request**.

### API Parameters & Specifications

#### &#x20;Search Query[​](https://serp-api.netnut.io/docs/SERP/Getting%20Started#----search-query-) <a href="#search-query" id="search-query"></a>

| Name | Status   | Description                                                  |
| ---- | -------- | ------------------------------------------------------------ |
| `wd` | Required | The 'wd' parameter defines the query you want to search for. |

#### &#x20;Pagination[​](https://serp-api.netnut.io/docs/SERP/Getting%20Started#--pagination-) <a href="#pagination" id="pagination"></a>

| Name | Status   | Description                                                                                                                                                       |
| ---- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `rn` | Optional | <p>Number of results to return (max 50).<br>Default: 10.<br>The API returns one fewer result than requested, so if you set rn=21 you will receive 20 results.</p> |
| `pn` | Optional | <p>Pagination offset.<br> <code>0</code> = first page,<br> <code>10</code> = second, <br><code>20</code> = third, etc.</p>                                        |

#### &#x20;Localization[​](https://serp-api.netnut.io/docs/SERP/Getting%20Started#--localization--) <a href="#localization" id="localization"></a>

| Name | Status   | Description                                                                                                                          |
| ---- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `ct` | Optional | <p>Language filter:<br> <code>0</code> = all, <br><code>1</code> = simplified Chinese,<br> <code>2</code> = traditional Chinese.</p> |

#### &#x20;Advanced Filters[​](https://serp-api.netnut.io/docs/SERP/Getting%20Started#--advanced-filters--) <a href="#advanced-filters" id="advanced-filters"></a>

| Name      | Status   | Description                                                                                                                                                                                                                                                 |                                                                                                   |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `rawHtml` | Optional | <p>The 'rawHtml' parameter defines the final output you want. It can be set to <code>1 (true)</code> or <code>0 (false)</code> to get the raw html response.<br>for receiving html only (without parsing) set it to <code>2 (only)</code></p>               |                                                                                                   |
| `device`  | Optional | <p>The 'device' parameter defines the device to use to get the Baidu search results. <br>The parameter can be set to <code>desktop</code> (default) to use a regular browser, or <code>mobile</code> to use a mobile browser (currently using iPhones).</p> |                                                                                                   |
| `f`       | Optional | <p>Search type.<br><code>8</code> = normal search,<br><code>3</code> = suggestion list,<br><code>1</code> = related search.</p>                                                                                                                             |                                                                                                   |
| `q5`      | Optional | <p>Keyword location filter.</p><p><code>1</code> = title only, </p><p><code>2</code> = URL only</p>                                                                                                                                                         |                                                                                                   |
| `q6`      | Optional | Restricts results to a specific domain.                                                                                                                                                                                                                     |                                                                                                   |
| `gpc`     | Optional | <p>Date range filter (Unix timestamp). </p><p>Example: <code>gpc=stf=START\_TIMESTAMP,END\_TIMESTAMP                                                                                                                                                        | stftype=1d</code></p><p><a href="https://www.unixtimestamp.com/">Encoding Link</a></p><p><br></p> |
| `bs`      | Optional | Previous query, used when navigating from a related search.                                                                                                                                                                                                 |                                                                                                   |
| `oq`      | Optional | Original query, used when navigating from related search results.                                                                                                                                                                                           |                                                                                                   |

### API Results HTTP Response

The API supports JSON responses. \
Here is an example schema of the Baidu SERP API response:

<pre class="language-json"><code class="lang-json">{
  "url": "string",
  "engine": "baidu",
  "general": {
    "id": "b5f237ef-4cdf-4697-b363-12d3aff38681",
    "timestamp": "2025-08-20 12:48:24 UTC",
    "baidu_url": "https://www.baidu.com/s?wd=消息&#x26;ct=0",
    "resultscount": 760
  },
  "input": {
    "wd": "消息",
    "device": "desktop",
    "engine": "baidu"
  },
  "organic_results": [
    {
      "position": 1,
      "title": "消息用英语说,有哪些是可数的,哪些是不可数的 - 百度文库",
      "snippet": "答案：news 新闻，消息（不可数）information 信息（不可数）message 口信（可数名词）解析：本题考查英语中表示\"消息\"的常见名词的可数性区分。解析如下：1.news（新闻/消息）：2.恒为不可数名词，形式上以-s结尾但实际不可数。使用时需遵循不可数名词规则：不能直接加a/an（错误：a news）表示单数时用\"a piece... ",
      "link": "https://wenku.baidu.com/view/d295380bfbc75fbfc77da26925c52cc58ad6903e.html",
      "displayed_link": "wenku.baidu.com",
      "tracking_link": "http://www.baidu.com/link?url=84TKhZfDTviZgKj8IGFdKYPkYtKrKIQUjwHMBG-8o_G-J2OGh_AGTFovBS5iv2nRyzPkYwACoBmpo8JXDuohcXjqkryabwTdTXczJOlsoXy-5BnYxMVqh5fzv_P5kq4D",
      "thumbnail": ""
    }
  ],
  "pagination": {
    "current": 1,
<strong>    "next": "https://www.baidu.com/s?wd=%E6%B6%88%E6%81%AF&#x26;base_query=消息&#x26;pn=40&#x26;oq=%E6%B6%88%E6%81%AF&#x26;rn=40&#x26;ie=utf-8&#x26;usm=3&#x26;rsv_pq=aff3064500162767&#x26;rsv_t=ac4cd08G4O%2BPonyq6yCdH%2FkI2aTch4g1JVOc6RL%2FUspqANO7kQKqgiymeiw&#x26;topic_pn=&#x26;rsv_page=1",
</strong>    "other_pages": {
      "2": "string",
      "3": "string",
      "4": "string"
    }
  },
  "html": "string"
}
</code></pre>

#### Key Notes:

* The top-level `engine` field will always be `baidu` when `siteType=baidu` is specified.
* `organic_results` contains an array of result objects, each including position, title, snippet, URL, display link, and optional thumbnails.
* The `pagination` object includes current and next page indices and URLs.
* If `rawHtml=1` is set, the full HTML source of the search result page will be included under the `html` field.


---

# 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-scraper-apis/serp-api/baidu-search/introduction-to-baidu-search-scraper.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.
