bdsearch

Original🇨🇳 Chinese
Translated

Baidu Search Tool. Use bdsearch CLI to search web content via Baidu AI Search API. Trigger scenarios: Users request Baidu search, news lookup, information retrieval, tutorial search, topic research, obtaining public web information, or needing structured search results.

3installs
Added on

NPX Install

npx skill4agent add lyhue1991/bdsearch bdsearch

SKILL.md Content (Chinese)

View Translation Comparison →

bdsearch

Encapsulates the
bdsearch
command-line tool for Baidu web search.

Core Capabilities

  1. Web Search - Query public web pages and news content
  2. Time Filtering - Supports the latest day, week, month, year, or custom date range
  3. Multi-format Output - Supports JSON, Markdown, and table formats
  4. Configuration Management - Supports API Key configuration and default parameter management

Workflow

🔍 Execute Web Search

When users express intentions of searching, looking up information, checking news, or conducting research, try executing the following search command:
bash
bdsearch "关键词" --format json --count 10
Common usages can also be applied as needed:
bash
bdsearch "人工智能" --count 10 --format json  # Search keywords, return top 10 results in JSON format
bdsearch "最新新闻" --freshness pd --format json # Search news from the latest day in JSON format
bdsearch "科技新闻" --freshness "2025-09-01to2025-09-08" --format markdown  # Search news within the specified date range in Markdown format

🛠️ Troubleshooting

If execution fails, first check if
bdsearch
is installed and if the Baidu API Key is configured correctly. Follow these steps for troubleshooting:
1. Check Installation → 2. Check Authentication Configuration
Step 1: Check if bdsearch is installed
bash
command -v bdsearch
If not installed, execute:
bash
npm install -g @lyhue1991/bdsearch
Step 2: Check Authentication Configuration
Check local configuration:
bash
bdsearch config --show
If not configured, check environment variables:
bash
printenv BAIDU_API_KEY
If still not configured, ask the user for the Baidu API Key and execute:
bash
bdsearch config --api-key "你的APIKey"

⚙️ Configure bdsearch

When users only need to configure the API Key or default parameters:
bash
bdsearch config --api-key "你的APIKey"
bdsearch config --default-format json --default-count 10 --default-freshness pd
View current configuration:
bash
bdsearch config --show
Reset configuration:
bash
bdsearch config --reset

📰 Query Latest Content

When users explicitly request "latest", "recent days", or "this week" content, prioritize using time filtering:
bash
bdsearch "AI 新闻" --freshness pd --format json
bdsearch "大模型进展" --freshness pw --format json

📄 Output Reader-friendly Results

When users need results for direct reading or copying:
bash
bdsearch "Node.js" --format markdown
bdsearch "Python" --count 10 --format table

Parameter Description

ParameterDescription
query
Search keyword, required
--count <number>
Number of returned results, range 1-50, default 10
--freshness <value>
Time filtering, supports
pd
,
pw
,
pm
,
py
or
YYYY-MM-DDtoYYYY-MM-DD
--format <format>
Output format, supports
json
,
markdown
,
table

Notes

  1. Prioritize JSON - When further analysis, field extraction, or content summarization is needed, prioritize using
    --format json
  2. Authentication Requirement - Must configure
    BAIDU_API_KEY
    before use, or save local configuration via
    bdsearch config --api-key
  3. Possible Duplicate Results - The upstream interface may return duplicate links; deduplication by
    url
    is necessary if needed
  4. Time Filtering Suggestion - Prioritize adding
    --freshness
    when querying news or dynamic information

Quick Reference

bash
# View help
bdsearch --help
bdsearch config --help

# View configuration
bdsearch config --show

# Set API Key
bdsearch config --api-key "你的APIKey"

# Basic search
bdsearch "人工智能" --format json

# Specify number of results
bdsearch "TypeScript 教程" --count 5 --format json

# Query latest content
bdsearch "最新新闻" --freshness pd --format json

# Custom date range
bdsearch "科技新闻" --freshness "2025-09-01to2025-09-08" --format json

# Reader-friendly output
bdsearch "Node.js" --format markdown
bdsearch "Python" --format table