SerpApi’s Baidu Search API

Justin O'Hara
SerpApi
Published in
3 min readSep 25, 2021

Following up a brief walkthrough of SerpApi’s Ebay’s Search Engine Results API. I wanted to highlight another one of the API’s that are available at our users disposal for SerpApi: Baidu.

For those who don’t know, Baidu is the dominant internet search engine company in China. This API is great for user’s who need to scrape data globally and want search engine results from a Chinese engine.

So let’s go ahead and breakdown the search, results, and the different parameters that can be found on the Playground.

SerpApi’s Playground for the Baidu Search Engine

Below is a link for our fairly common whitelisted search = “coffee”

And while I am not a Chinese reader/writer the data on the JSONpoints to the right section on the HTML:

`organic_results` highlighted on the search for “coffee” in SerpApi’s Baidu engine

Here’s the scraped JSON results for the answer_box:

answer_box results for “coffee” in SerpApi’s Baidu engine

The Localization card that is available defines which language to restrict results. Differing than the localization parameters for the Google Search, this can be switched from all Languages, Simplified Chinese and Traditional Chinese.

Onto the next card for Pagination. While there are different parameter names like “pn” and “rn” the same theory applies to both of these; result offset, and number of results.

Below is a link to the next “page” of results by setting the ‘pn’ result offset to 10.

Now the next set of parameters that are available on the playground:

Advanced Filters and Advanced Baidu Parameter cards

The lm parameter is for the time period of results: (e.g., 7 only returns results from the past 7 days.).

The q5 parameter is similar to using inurl: or intitle:. (e.g., 1 to search by page title, 2 to search by web address.).

The q6 parameter is similar to using site:. (e.g., q6=serpapi.com to search for results only from the domain serpapi.com).

The bs parameter defines the previous search query.

The oq parameter defines the original search query when navigated from a related search.

And then f Defines the originating search type. (e.g., 8 is a normal search, 3 is from the suggestion list, and 1 is a related search.

These are all best to test through the playground to make sure you are receiving the correct results. It is a bit tough to navigate with Baidu because it being a Chinese search engine and not being a native Chinese speaker.

The last few parameters are common within our Search Engines. no_cache and also the testing “other” parameter location.

You can sign-up for SerpApi here: https://serpapi.com/

You can find the SerpApi user forum here: https://forum.serpapi.com/

You can find the API documentation here: https://serpapi.com/search-api/

--

--