Skip to main content
GET
Baidu Web Search
Search baidu.com — the web SERP of China’s #1 search engine. Every organic result carries the real target URL in url (decoded from Baidu’s mu attribute), alongside the baidu.com/link?url= tracking redirect in baidu_url. Credits: 5

Authorization

string
required
Your ScrapeBadger API key.

Query Parameters

string
required
Search keywords, e.g. 咖啡机 or coffee machine. URL-encode as UTF-8.
integer
default:"1"
Result page, 176. Baidu’s SERP stops serving past ~76 pages regardless of the total it reports — see Pagination.
integer
default:"10"
Results per page, 150 (Baidu’s own cap). The page offset is (page - 1) * num, so keep num fixed across a crawl of one query.
string
default:"all"
Restrict result language. One of all, zh-cn (simplified Chinese), zh-tw (traditional Chinese) — Baidu’s only three language codes.
integer
Unix timestamp — only results published after this.
integer
Unix timestamp — only results published before this. Pass either bound alone; the other end of the window defaults to open.

Response

string
Echo of the requested query.
integer
The page returned.
integer
Results per page that was requested.
integer
Baidu’s own claim, parsed from 百度为您找到相关结果约N个 — not a reachable count. Useful as a relative signal only. null when Baidu omits the line.
string
The baidu.com URL that was fetched.
OrganicResult[]
Organic results on this page.
Baidu’s query suggestions from the foot of the SERP.
Only position, title, query, page, num and url are guaranteed present. Every other field is nullable — Baidu’s SERP renders a different field set per result template (tpl).

Example

Response

Pagination

total_results is not reachable. Baidu’s SERP dries up past roughly page 76, so page is clamped to 176 — a request beyond the wall is rejected rather than billed for an empty page.
The page offset is (page - 1) * num. Raising num is therefore the cheaper route to depth than raising page: num=50 reaches 500 results in 10 calls instead of 50. Keep num fixed for the whole crawl of one query — changing it mid-crawl shifts the offset window and re-serves rows you already have.
To go wider than one query’s wall, expand the seed rather than paging deeper: feed related_searches (free, already in this response) and /autocomplete (1 credit) back in as new queries, then merge results on url.

Date filtering

time_from / time_to are Unix timestamps and map onto Baidu’s own gpc filter. Either bound may be passed alone — the open end defaults to 0 (from) or now (to).
Baidu filters on its own idea of a page’s publish date, which is not always the date rendered in date. Treat the window as a filter on Baidu’s index, not a guarantee about the page.

Errors