全网搜
Integrates with the web search API to fetch news and articles from Baidu, Google, and a pre-indexed Elasticsearch database using comprehensive search by defa...
Like a lobster shell, security has layers — review code before you run it.
License
Runtime requirements
SKILL.md
全网搜索 (Whole Network Search)
This skill guides the agent to call the web search API for retrieving articles and news from multiple sources.
When to Use
Apply this skill when the user:
- Asks to search the web or gather information online
- Needs news articles or references by keyword
- Wants to retrieve content from Baidu, Google, or a local ES index
- Requires real-time web search or pre-indexed warehouse search
By default, this skill performs comprehensive search across ALL available sources simultaneously to provide the most complete results.
API Overview
Endpoint: POST /web_search
Base URL: http://101.245.108.220:9004
Authentication: No authentication required (free service)
Request
For comprehensive search (default behavior), the skill will use the script from overall.md to perform 4 parallel API calls automatically:
- Call 1:
search_source=baidu_search,mode=network(百度新闻/资讯) - Call 2:
search_source=google_search,mode=network(谷歌新闻/资讯) - Call 3:
search_source=baidu_search_ai,mode=network(百度 AI 搜索) - Call 4:
mode=warehouse(Elasticsearch 索引库,忽略 search_source)
Headers
| Header | Required | Description |
|---|
| Content-Type | Yes | application/x-www-form-urlencoded (form data) |
Form Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| keyword | string | Yes | - | Search keyword(s),多个关键词用空格分隔 |
| search_source | string | No | - | Engine: baidu_search, google_search, baidu_search_ai. Note: Ignored when using default comprehensive search |
| mode | string | No | - | network = live crawl, warehouse = ES index. Note: Ignored when using default comprehensive search |
| page | int | No | 1 | Page number (starts from 1) |
Comprehensive Search (All Sources)
当用户要求进行全面搜索(即同时搜索所有可用来源)时,必须使用overall.md中的脚本进行搜索,而不是使用下面的示例代码。
When the user wants to search across ALL available sources simultaneously (comprehensive search), you should:
Example Implementation (Python asyncio):
import aiohttp
import asyncio
API_URL = "http://101.245.108.220:9004/web_search"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
SEARCH_CONFIGS = [
{"name": "百度搜索", "mode": "network", "search_source": "baidu_search"},
{"name": "谷歌搜索", "mode": "network", "search_source": "google_search"},
{"name": "百度 AI 搜索", "mode": "network", "search_source": "baidu_search_ai"},
{"name": "全库搜", "mode": "warehouse", "search_source": None}
]
async def fetch_search(session, semaphore, config, keyword, page):
async with semaphore:
data = {
"keyword": keyword,
"page": page,
"mode": config['mode'],
}
if config['search_source']:
data["search_source"] = config['search_source']
async with session.post(API_URL, headers=headers, data=data) as response:
result = await response.json()
return result.get('references', [])
async def comprehensive_search(keyword, page=1):
async with aiohttp.ClientSession() as session:
semaphore = asyncio.Semaphore(5) # Max 5 concurrent requests
tasks = [fetch_search(session, semaphore, config, keyword, page)
for config in SEARCH_CONFIGS]
results = await asyncio.gather(*tasks)
# Flatten all references into one list
all_references = [ref for refs in results for ref in refs]
return all_references
asyncio.run(comprehensive_search("人工智能"))
Parameter Constraints
search_source: One ofbaidu_search,google_search,baidu_search_aimode: One ofnetwork,warehouse- When
mode=warehouse, search is performed against the Elasticsearch index (ignores search_source) - When
mode=network, usesearch_sourceto select Baidu, Google, or Baidu AI search
Response Format
{
"code": 200,
"message": "success",
"references": [
{
"title": "Article title",
"sourceAddress": "https://example.com/article",
"origin": "Source name",
"publishDate": "2025-03-24 12:00:00",
"summary": "Article summary or snippet"
}
]
}
Usage Examples
Example 1: Search Baidu news
POST http://101.245.108.220:9004/web_search
Headers: Content-Type: application/x-www-form-urlencoded
Body (form): keyword=人工智能&search_source=baidu_search&mode=network&page=1
Example 2: Search Google news
POST http://101.245.108.220:9004/web_search
Headers: Content-Type: application/x-www-form-urlencoded
Body (form): keyword=AI&search_source=google_search&mode=network&page=1
Example 3: Search warehouse (ES index)
POST http://101.245.108.220:9004/web_search
Headers: Content-Type: application/x-www-form-urlencoded
Body (form): keyword=机器学习&mode=warehouse&page=1
Example 4: cURL
curl -X POST "http://101.245.108.220:9004/web_search" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "keyword=科技新闻&search_source=baidu_search&mode=network&page=1"
Error Codes
| Code | Message | Cause |
|---|
| 400 | search_source参数错误 | Invalid search_source value | | 400 | mode参数错误 | Invalid mode value | | 400 | page参数错误 | Invalid page (non-integer or 0) |
Integration Steps
- API base URL:
http://101.245.108.220:9004,无需配置API密钥(免费服务) - By default, the skill will perform comprehensive search across all sources using the script from overall.md. Optional: Determine the desired
search_source(Baidu / Google / Baidu AI) ormode(network / warehouse) if you want to override the default comprehensive search behavior - Call
POST /web_searchwith form-encoded parameters - Parse
referencesfrom the response and usetitle,sourceAddress,summaryas needed
Files
3 totalComments
Loading comments…
