Overview
The ScrapeBadger Baidu API turnsbaidu.com into a clean JSON feed: the
web SERP (with language and publish-date filters), the news vertical, image
search with full-size image URLs and pixel dimensions, and search-box
autocomplete.
Baidu is China’s #1 search engine at roughly 60% market share — the single
largest search surface outside Google, and the one that decides visibility for
the Chinese-language web. It is also the search engine most Western SEO and
market-research tooling simply skips.
All endpoints are
GET, live under https://scrapebadger.com/v1/baidu/*,
and authenticate with the X-API-Key header. Credits are charged per request
(see the table below) and reported on the X-Credits-Used response header.The real URL, not the redirect
Baidu does not link straight to a result. Every organic link is abaidu.com/link?url=... tracking redirect that only resolves to the
destination when followed — which is why competing Baidu APIs hand you a
baidu.com URL and leave you to make one extra HTTP request per result to
learn where it actually goes.
ScrapeBadger returns both, on every result:
Global access, no China proxy
Baidu is reachable from outside China but rate-limits and challenges foreign traffic aggressively. ScrapeBadger absorbs that: requests are served through its own exit pool with session reuse and challenge handling, so you do not need a China-based proxy, a mainland VPS, or an ICP filing. Call the API from anywhere.Features
- Web search — organic results with
title, realurl,snippet,source(the site name Baidu shows),date/date_at,thumbnailand Baidu’s owntpltemplate id. Up to 50 results per page. - Language filter — restrict to simplified (
zh-cn) or traditional (zh-tw) Chinese, or leave it open withall. - Publish-date window —
time_from/time_toas Unix timestamps, mapped onto Baidu’s owngpcdate filter. - Related searches — Baidu’s query suggestions from the foot of the SERP, with their SERP URLs, for keyword expansion.
- News vertical — articles with publisher, publish date and real article URLs, ordered by relevance or recency.
- Image search — full-size
image_url(Baidu’s decodedobjURL), three Baidu-hosted copies (thumbnail_url,middle_url,hover_url), pixelwidth/height, format, and the source page (from_url,from_title). - Autocomplete — Baidu’s search-box suggestions for 1 credit, the cheapest way to expand a seed term into real Chinese queries.
Dates
Every dated result ships two fields:There is deliberately no timestamp field. Baidu’s SERP carries no
time-of-day, so a midnight epoch would be fabricated precision. Sort on
date_at and keep date for display.Credits
Quickstart
Pagination limits
total_results is Baidu’s own claim (parsed from
百度为您找到相关结果约N个), not a reachable count. Baidu’s SERP stops
serving results past roughly page 76 regardless of the total it reports, so
page is clamped to 1–76 — a request beyond the wall is rejected rather
than billed for a structurally empty page.
numcontrols page size,1–50(Baidu’s own cap). Fewer, bigger pages is the cheaper way to depth:num=50reaches 500 results in 10 calls.- Page offset is
(page - 1) * num, so changingnumbetween pages shifts the window. Keepnumfixed for the whole crawl of one query. - Images are a fixed 30 per page,
page1–50.
Character encoding
Queries are Chinese in practice, so URL-encode the query as UTF-8 and let your HTTP client do it (URLSearchParams, requests params=, the SDKs).
Every response is UTF-8; snippet and title come back with Baidu’s own
punctuation (,, 、) intact rather than transliterated.
Latin queries work too — Baidu serves a mixed SERP for coffee machine — but
Chinese terms return meaningfully richer results.
Errors
Baidu serves a challenge page with HTTP 200. Those are detected by result-
container marker, not status code, and surfaced as
422 so a challenge is
never billed or mistaken for a genuinely empty SERP.
