Baidu Search
Get Baidu search results as JSON.
GET/api/v1/baidu/search
Costs 1 credit per request; failed requests are refunded. Authentication, the search_metadata envelope and error codes are the same as for every endpoint (see the API reference). Try it in the playground.
Parameters
Search query
Search the Baidu web index.
| Parameter | Type | Description |
|---|---|---|
qrequired | string | Required search text, trimmed to 1 through 500 characters. Unicode queries are supported. Control characters are rejected.Up to 500 characters. |
Pagination
Choose a result offset and requested page size.
| Parameter | Type | Description |
|---|---|---|
pn | integer | Zero-based result offset from 0 through 750, not a page number. Use pagination.next_pn or serpfast_pagination.next to continue.Default: 0.Range: 0 to 750. |
rn | "10" | "20" | "50" | Requested result count: 10, 20, or 50. Defaults to 10. Baidu can return fewer web results when a page includes other result modules.Default: 10. |
Response
A JSON object with search_metadata (request id, credits used and remaining) and the result data: organic_results. Groups and fields depend on the content of each page, so treat every field as optional.
Examples
cURL
curl "https://serpfast.com/api/v1/baidu/search?q=python+documentation&pn=0&rn=10" \
-H "Authorization: Bearer $SERPFAST_KEY"Node.js 18+
const params = new URLSearchParams({
"q": "python documentation",
"pn": 0,
"rn": 10
});
const res = await fetch(`https://serpfast.com/api/v1/baidu/search?${params}`, {
headers: { Authorization: `Bearer ${process.env.SERPFAST_KEY}` },
});
const data = await res.json();
console.log(data);Python
import os, requests
params = {
"q": "python documentation",
"pn": 0,
"rn": 10
}
res = requests.get(
"https://serpfast.com/api/v1/baidu/search",
params=params,
headers={"Authorization": f"Bearer {os.environ['SERPFAST_KEY']}"},
timeout=120,
)
print(res.json())