← Back to Skills
Web Search

baidu-search

ide-rea By ide-rea 👁 4 views ▲ 0 votes

Search the web using Baidu AI Search Engine (BDSE).

GitHub
---
name: baidu-search
description: Search the web using Baidu AI Search Engine (BDSE). Use this when you need live information, documentation, or to research topics and the built-in web_search is unavailable.
metadata: { "openclaw": { "emoji": "πŸ”οΈŽ",  "requires": { "bins": ["python3"], "env":["BAIDU_API_KEY"]},"primaryEnv":"BAIDU_API_KEY" } }
---

# Baidu Search Skill

This skill allows OpenClaw agents to perform web searches via Baidu AI Search Engine (BDSE).

## Workflow

1. The skill executes the Python script located at `scripts/search.py`
2. The script makes a POST request to the Baidu AI Search API
3. The API returns structured search results with titles, URLs, and content snippets

## Parameters

#### request body structure
|  param   | type     | required|  default|  description|
|----------|----------|----------|----------|-----------|
|  query | str        | yes      |          | user query content|
|  edition | str      | no      |  standard     |Optional value: standard: Full version. lite: Standard version. |
|  resource_type_filter | list[obj]         | no      |    [{"type": "web","top_k": 20},{"type": "video","top_k": 0},{"type": "image","top_k": 0},{"type": "aladdin","top_k": 0}]      | Support setting web pages, videos, images, and Aladdin search modes. The maximum value of top_k for web pages is 50, for videos it is 10, for images it is 30, and for Aladdin it is 5|
|  search_filter | list[obj]      | no      |       |Search and filter based on the sub-conditions under SearchFilter. For the usage method, please refer to the details of the SearchFilter table.|
|  block_websites | list[str]      | no      |       |List of sites that need to be blocked. Filter the search results belonging to this site and its sub-sites in the site list. Example: ["tieba.baidu.com"]|
|  search_recency_filter | str      | no      |      |Filter based on the publication time of the web page. Enumeration values: week: The last 7 days month: The last 30 days semiyear: The last 180 days, year: The last 365 days|
|  safe_search | bool      | no      |  false    |Whether to enable secure search or not, if it is enabled, a stricter risk control strategy will be adopted, and some queries that may involve pornography or terrorism will not return search results.|

### SearchFilter table
|  param   | type     | required|  default|  description|
|----------|----------|----------|----------|-----------|
|  match | obj        | no      |          |filter site condition|
|  match.site | str      | no      |          |Support setting search conditions for specified sites, that is, only conduct content search within the set sites. Currently, it supports setting up 100 sites. Example: ["tieba.baidu.com", "baike.baidu.com"] Note: This is a paid feature and is currently free for a limited time.|
|  range | obj      | no      |          |Range query. It can be used for numeric and date-type fields. The grammar format is as follows: "range" : { "{field}" : { "gte" : " {lowerBound}" , "gt" : "{lowerBound}" , "lte" : "{upperBound}" , "lt" : "{upperBound}" }} Entity (field) pageTime: The name of the entity representing the publication time, indicating a range query for pageTime. Here, pageTime corresponds to the page_time field in the response data. The filtering function for web page publication time is only applicable to available and displayable libraries. Other results such as videos will not be recalled.|

#### SearchFilter example
```json
{
    "match": {
        "site": ["tieba.baidu.com", "baike.baidu.com"]
    },
    "range": {
        "pageTime": {
            "gte": "now-1w/d",
            "lt": "now/d"
        }
    }
}
```

#### range usage description

Query range (lowerBound\upperBound)
1. Specify date Specify search date range, format: YYYY-MM-DD, for example: quot; range" : { " page_time" : { " gte" : " 2025-11-01" , " lte" : " 2025-11-04" 
2. Time units supported by fixed packages: y (year), M (month), w (week), d (day). Currently, the following fixed packages are provided. Any other packages are illegal. Among them, "now" To represent the current time, a mathematical expression can be added after "now" : "-1w" indicates minus one week. "-1M" indicates minus one month; "-1y" indicates minus one year; "/d" indicates the start/end time normalized to the current day. 
the fixed time unit enums:
   now/d 
   now-1w/d: One week 
   now-2w/d: Two weeks 
   now-1M/d: One month 
   now-3M/d: Three months 
   now-6M/d: Six months 
   now-1y/d: One year 

Parameter limitation description: 
1.lte usage note: The range range will participate in the calculation of the cache key in the retrieval system. After the lte performs upward rounding and rounding, due to cache, the result timeliness may lag behind the lte value specified by match. 
2. The lowerBound and upperBound times must exist simultaneously; otherwise, this function will not take effect. 
3. Only one of gte and gt needs to be passed. If both are passed, only gt will take effect


## Example Usage

```bash
python3 skills/baidu-search/scripts/search.py '{"query":"εŒ—δΊ¬ζœ‰ε“ͺδΊ›ζ—…ζΈΈζ™―εŒΊ","resource_type_filter":[{"type":"web","top_k":20}],"search_filter":{"match":{"site":["www.weather.com.cn"]}},"search_recency_filter":"year"}'
```

## Current Status

The Baidu search skill is fully functional and can be used to retrieve current information from the web. As demonstrated, it successfully retrieved weather information for Beijing, showing current conditions and forecasts.
web search

Comments

Sign in to leave a comment

Loading comments...