OpenSERP Cloud Updated Quickstart →

Baidu Search API

Query Baidu and get structured web results as JSON. Baidu is the dominant engine in mainland China, and its ranking has almost no overlap with Google if you...

Query Baidu and get structured web results as JSON. Baidu is the dominant engine in mainland China, and its ranking has almost no overlap with Google - if you care about Chinese-language search or the China market, this is the engine to query. This page shows a Baidu search in the SDKs and with curl, with notes on Simplified Chinese queries.

Examples run against OpenSERP Cloud at https://api.openserp.org. The same request works on a self-hosted open-source OpenSERP server - point the SDK at your own baseUrl instead of passing apiKey.

export OPENSERP_API_KEY="osk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

JavaScript / TypeScript

npm install @openserp/sdk
import { OpenSERP } from "@openserp/sdk";

const client = new OpenSERP({ apiKey: process.env.OPENSERP_API_KEY });

const { results } = await client.search({
  engine: "baidu",
  text: "机器学习教程",
  limit: 10,
  region: "CN",
  lang: "ZH",
});

for (const r of results) {
  console.log(r.rank, r.title, r.url);
}

Python

pip install openserp
import os
from openserp import OpenSERP

with OpenSERP(api_key=os.environ["OPENSERP_API_KEY"]) as client:
    response = client.search(engine="baidu", text="机器学习教程", limit=10, region="CN", lang="ZH")
    for r in response.results:
        print(r.rank, r.title, r.url)

curl

curl "https://api.openserp.org/v1/baidu/search?text=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E6%95%99%E7%A8%8B&limit=10&region=CN&lang=ZH" \
  -H "Authorization: Bearer $OPENSERP_API_KEY"

URL-encode Chinese queries in raw HTTP calls. The SDKs handle encoding for you.

Want to preview the ranking first? Run the query in the Search Playground and inspect the results.

Notes for Baidu

  • Use Simplified Chinese (ZH) queries and set region=CN for results that match what a user in China sees.
  • Baidu favours Chinese-language and China-hosted pages, so a query that returns English results on Google will look very different here.
  • The advanced filters (site, file, date) are best-effort outside Google - treat them as hints rather than guarantees on Baidu.

When to reach for Baidu

  • Your market, audience, or rank tracking is in mainland China.
  • The query is in Chinese and you need engine-native ranking.
  • You are building a dataset that needs China coverage alongside Western engines.

To compare a page’s Baidu rank against Google in one request, see megasearch & ranking diff.

Next steps