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
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
Search Query
wd
Required
The 'wd' parameter defines the query you want to search for.
Pagination
rn
Optional
Number of results return (max 50). Default: 10
pn
Optional
Pagination offset.
0 = first page,
10 = second,
20 = third, etc.
Localization
ct
Optional
Language filter:
0 = all,
1 = simplified Chinese,
2 = traditional Chinese.
Advanced Filters
rawHtml
Optional
The 'rawHtml' parameter defines the final output you want. It can be set to 1 (true) or 0 (false) to get the raw html response.
for receiving html only (without parsing) set it to 2 (only)
device
Optional
The 'device' parameter defines the device to use to get the Baidu search results.
The parameter can be set to desktop (default) to use a regular browser, or mobile to use a mobile browser (currently using iPhones).
f
Optional
Search type.
8 = normal search,
3 = suggestion list,
1 = related search.
q5
Optional
Keyword location filter.
1 = title only,
2 = URL only
q6
Optional
Restricts results to a specific domain.
gpc
Optional
Date range filter (Unix timestamp).
Example: gpc=stf=START_TIMESTAMP,END_TIMESTAMP|stftype=1d
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:
Key Notes:
The top-level
enginefield will always bebaiduwhensiteType=baiduis specified.organic_resultscontains an array of result objects, each including position, title, snippet, URL, display link, and optional thumbnails.The
paginationobject includes current and next page indices and URLs.If
rawHtml=1is set, the full HTML source of the search result page will be included under thehtmlfield.
Last updated
