百度网页搜索技能 - 使用百度搜索 API 进行网络搜索
| Property | Value |
|---|---|
| ---------- | ------- |
| Name | baidu-web-search |
| Version | 1.0.0 |
| Author | PocketAI for Leo |
| License | MIT |
| Category | Search |
| Required Env Vars | BAIDU_API_KEY |
This skill requires the following environment variables:
| Variable | Description | Required | How to Get |
|---|---|---|---|
| ---------- | ------------- | ---------- | ------------ |
BAIDU_API_KEY | Baidu Search API key | ✅ Yes | https://ai.baidu.com/ |
Configuration:
export BAIDU_API_KEY="your_baidu_api_key"
cd ~/.openclaw/workspace/skills
# Already installed at: baidu-web-search/
Option 1: Using .env file (Recommended)
# Copy the example .env file
cp .env.example .env
# Edit .env and add your API key
nano .env # or use your favorite editor
Option 2: Using environment variable
export BAIDU_API_KEY="your_baidu_api_key"
from src.baidu_search import baidu_search
# Search with default 10 results
result = baidu_search("人工智能 2026")
print(result)
# Search with custom result count
result = baidu_search("新能源汽车", count=5)
print(result)
# Search with default 10 results
python3 src/baidu_search.py "人工智能 2026"
# Search with custom result count
python3 src/baidu_search.py "新能源汽车" 5
from src.baidu_search import BaiduSearch, baidu_search
# Method 1: Simple search
result = baidu_search("OpenClaw AI", count=10)
print(result)
# Method 2: Using client
searcher = BaiduSearch(api_key="your_api_key")
results = searcher.search("OpenClaw", count=5)
for result in results:
print(f"Title: {result['title']}")
print(f"URL: {result['url']}")
print(f"Snippet: {result['abstract']}\n")
| Variable | Description | Required |
|---|---|---|
| ---------- | ------------- | ---------- |
BAIDU_API_KEY | Baidu Search API key | ✅ Yes |
baidu-web-search/
├── src/
│ └── baidu_search.py # Main search client
├── SKILL.md # This file
└── README.md # Documentation
result = baidu_search("最新科技新闻 2026")
result = baidu_search("人工智能 医疗 应用")
result = baidu_search("智能手机 评测")
result = baidu_search("北京 美食 推荐")
{
"title": "网页标题",
"url": "网页链接",
"abstract": "摘要内容"
}
🔍 Baidu Search Results for: 人工智能 2026
Found 10 results:
1. **2026 年人工智能发展趋势**
URL: https://example.com/ai-trends-2026
2026 年人工智能领域将呈现以下发展趋势...
2. **人工智能应用场景**
URL: https://example.com/ai-applications
人工智能在医疗、金融等领域的应用...
MIT License - See LICENSE file for details.
Happy Searching! 🔍
Last Updated: 2026-03-17
Version: 1.0.0
Author: PocketAI for Leo
共 1 个版本