# Baidu Web, Image & News Results Extractor (`dataspryva/baidu-web-image-and-news-results-extractor`) Actor

Runs search queries against Baidu's web, image, or news results and returns titles, URLs, snippets, dates, and image metadata, with filters for time range, file type, site, and exact phrase.

- **URL**: https://apify.com/dataspryva/baidu-web-image-and-news-results-extractor.md
- **Developed by:** [Dataspryva](https://apify.com/dataspryva) (community)
- **Categories:** SEO tools, News, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.49 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Baidu Web, Image & News Results Extractor

Baidu is the dominant search engine for Chinese-language content, and its result pages work differently from Google's — different ranking signals, different SERP layout, and separate verticals for web, image, and news queries. This actor runs one or more queries against Baidu's web search, image search, or news search and returns the results as structured rows, including Baidu's own search-operator filters (site, filetype, exact phrase, exclude words, title-only).

### What this actor does

- Runs any number of queries against one of three Baidu verticals per run: web, image, or news.
- Applies Baidu's native search operators from simple input fields — no need to hand-build query strings for `site:`, `intitle:`, exact phrases, or excluded terms.
- Restricts web and news results to a publication window (last day, week, month, or year).
- Captures the "related searches" Baidu shows under organic web results as their own records.
- Resolves Baidu's redirect links to the real destination URL when the direct link isn't already present on the page.
- Fields a result doesn't have (e.g. no snippet, no image dimensions) are left out of that record.

### Output per result (by mode)

#### Web search (`mode: webSearch`)

- `query`, `position`, `page` — the query text, rank position, and result page it came from
- `resultType` — `organic` for a normal result, `related_search` for a related-search suggestion
- `title`, `url`, `snippet`, `date` — standard result fields (present when Baidu shows them)
- `displayUrl` — the domain shown under the result title
- `baiduUrl` — Baidu's own redirect link, kept alongside `url` when one was present
- `searchTerm` — present only on `related_search` records; the suggested query text
- `scrapedAt` — collection timestamp

#### Image search (`mode: imageSearch`)

- `query`, `position`
- `title` — caption or source page title, when available
- `imageUrl`, `thumbnailUrl` — full-size and thumbnail image URLs
- `sourceUrl`, `sourceDomain` — the page the image was found on
- `width`, `height` — pixel dimensions, when Baidu reports them
- `scrapedAt`

#### News search (`mode: newsSearch`)

- `query`, `position`, `page`
- `title`, `url`, `snippet`, `date`
- `source` — the publisher/outlet name, when Baidu shows one
- `scrapedAt`

### Input

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `queries` | Array | `["artificial intelligence"]` | One or more search terms; each is scraped independently up to `maxResults`. Required. |
| `mode` | String (select) | `webSearch` | `webSearch`, `imageSearch`, or `newsSearch`. |
| `maxResults` | Integer | 50 | Maximum results to return per query, across all result pages (1-500). |
| `timeRange` | String (select) | `any` | `any`, `day`, `week`, `month`, `year`. Applies to `webSearch` and `newsSearch` only. |
| `language` | String (select) | `any` | `any`, `simplified`, `traditional`. `webSearch` only. |
| `filetype` | String (select) | `any` | `any`, `pdf`, `doc`, `xls`, `ppt`, `rtf`. `webSearch` only. |
| `siteRestrict` | String | – | Limit results to one domain, e.g. `wikipedia.org`. `webSearch` only. |
| `exactPhrase` | String | – | Require this exact phrase in results. `webSearch` only. |
| `excludeWords` | Array | `[]` | Words to exclude from results. `webSearch` only. |
| `titleOnly` | Boolean | false | Match the query against page titles only. `webSearch` only. |
| `resolveUrls` | Boolean | true | Follow Baidu's redirect link to the real destination URL in the rare case it wasn't already extracted directly from the page. `webSearch` only. |
| `proxyConfiguration` | Object | – | Apify Proxy settings; recommended when requesting from outside China. |

#### Example: Simplified Chinese web results from the last month

```json
{
  "mode": "webSearch",
  "queries": ["人工智能 最新进展"],
  "maxResults": 50,
  "timeRange": "month",
  "language": "simplified"
}
```

#### Example: image search

```json
{
  "mode": "imageSearch",
  "queries": ["Great Wall of China"],
  "maxResults": 100
}
```

#### Example: news search restricted to the last week

```json
{
  "mode": "newsSearch",
  "queries": ["technology innovation"],
  "maxResults": 30,
  "timeRange": "week"
}
```

#### Example: PDF files on one domain, excluding a term

```json
{
  "mode": "webSearch",
  "queries": ["年度报告"],
  "filetype": "pdf",
  "siteRestrict": "gov.cn",
  "excludeWords": ["draft"]
}
```

### Use cases

- **Baidu SEO tracking** — check where your pages rank for target keywords on Baidu over time.
- **Competitor monitoring** — see which domains and content types rank for a competitor's brand or product terms.
- **Chinese media monitoring** — pull news coverage of a topic, brand, or event from Baidu News.
- **Academic and research sourcing** — collect Chinese-language sources on a topic using `filetype` and `siteRestrict` filters.
- **Visual research** — gather image results and their source pages for a topic with `imageSearch`.

### FAQ

**Why would a run return zero results?**
Baidu is more likely to throttle or block requests coming from outside China. Setting `proxyConfiguration` with Apify Proxy enabled generally resolves this.

**What's a `related_search` record?**
It's the "related searches" suggestions Baidu shows beneath organic web results, captured with `resultType: "related_search"` and the suggestion text in `searchTerm`, rather than a regular result.

**Does `language` translate my query?**
No — it restricts which script (Simplified or Traditional Chinese) the returned pages are written in; it doesn't translate or rewrite your search terms.

**Why do some web results have a `baiduUrl` but others don't?**
Baidu usually embeds the real destination URL directly in the page, so `url` is already correct and `baiduUrl` is omitted. `baiduUrl` only appears when the page only exposed a Baidu redirect link for that result.

**Can I combine `exactPhrase`, `siteRestrict`, and `excludeWords` in one query?**
Yes, these web-search operators combine freely in the same query.

**Is there a limit on how many results I can get per query?**
Yes, `maxResults` caps out at 500 per query. Run the same query again or split it across multiple queries in one run if you need more coverage.

**Does image search work the same as Google Images for the same query?**
No — Baidu's image index and ranking are independent of Google's, so results for the same query can differ noticeably.

**Is this affiliated with Baidu?**
No. This actor reads Baidu's public search result pages and is not affiliated with Baidu, Inc.

# Actor input Schema

## `mode` (type: `string`):

Which Baidu vertical to scrape.

## `queries` (type: `array`):

One or more search terms. Each query is scraped independently up to maxResults.

## `maxResults` (type: `integer`):

Maximum number of results to return for each query (across all pages).

## `timeRange` (type: `string`):

Restrict results to a publication time window. Applies to webSearch and newsSearch modes only; Baidu image search has no time filter.

## `language` (type: `string`):

Restrict results to pages in a specific Chinese script. Only applies to webSearch mode.

## `filetype` (type: `string`):

Restrict results to a specific document format. Only applies to webSearch mode.

## `siteRestrict` (type: `string`):

Limit results to a specific website domain (e.g. wikipedia.org). Equivalent to the site: operator. Only applies to webSearch mode.

## `exactPhrase` (type: `string`):

Require results containing this exact phrase. Wrapped in quotes automatically. Only applies to webSearch mode.

## `excludeWords` (type: `array`):

Words to exclude from results. Each is prefixed with the minus (-) operator. Only applies to webSearch mode.

## `titleOnly` (type: `boolean`):

When enabled, Baidu matches search terms in page titles only (intitle: operator). Only applies to webSearch mode.

## `resolveUrls` (type: `boolean`):

When enabled, follows Baidu redirect links to extract the actual destination URL. The real URL is always extracted from the page when available, so this mainly affects fallback behaviour. Only applies to webSearch mode.

## `proxyConfiguration` (type: `object`):

Proxy settings for accessing Baidu. Using Apify Proxy (AUTO datacenter group) is strongly recommended for non-Chinese IP addresses to avoid blocks.

## Actor input object example

```json
{
  "mode": "webSearch",
  "queries": [
    "artificial intelligence"
  ],
  "maxResults": 50,
  "timeRange": "any",
  "language": "any",
  "filetype": "any",
  "excludeWords": [],
  "titleOnly": false,
  "resolveUrls": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset containing all scraped Baidu search results.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "webSearch",
    "queries": [
        "artificial intelligence"
    ],
    "maxResults": 50,
    "timeRange": "any",
    "language": "any",
    "filetype": "any",
    "excludeWords": [],
    "titleOnly": false,
    "resolveUrls": true,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": []
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("dataspryva/baidu-web-image-and-news-results-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "webSearch",
    "queries": ["artificial intelligence"],
    "maxResults": 50,
    "timeRange": "any",
    "language": "any",
    "filetype": "any",
    "excludeWords": [],
    "titleOnly": False,
    "resolveUrls": True,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": [],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("dataspryva/baidu-web-image-and-news-results-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "webSearch",
  "queries": [
    "artificial intelligence"
  ],
  "maxResults": 50,
  "timeRange": "any",
  "language": "any",
  "filetype": "any",
  "excludeWords": [],
  "titleOnly": false,
  "resolveUrls": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}' |
apify call dataspryva/baidu-web-image-and-news-results-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dataspryva/baidu-web-image-and-news-results-extractor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/psB9o5eBtflSKjKWE/builds/bv9CzmWZ0ZCw7Pvln/openapi.json
