基于SearchAPI(Google)的网页/新闻/财经/视频/地图/酒店/航班搜索工具,支持时间筛选,适用于代理获取实时网络信息。
A multi-type search tool based on SearchAPI (Google), ideal for agents to retrieve real-time web information.
bash
# Copy tools/websearchapi to your project
# Configure API Key (required)
cd tools/websearchapi
node websearchapi.js config set-key YOUR_API_KEY
Get API Key: https://searchapi.io (Free registration)
⚠️ Important: Use your own API Key, not someone else's
Call via exec tool:
bash
node <path>/websearchapi.js <command> [keyword] [options]
TypeCommandDescriptionWebs or searchGeneral web searchNewsnewsLatest newsVideovideoVideo searchFinancefinanceStock/Financial infoMapsmapsPlaces/BusinessHotelshotelsHotel searchFlightsflightsFlight search
OptionDescriptionDefault--numNumber of results5--langLanguagezh-CN--glCountrycn--timeTime rangenone--jsonJSON outputtext
ValueDescriptionlast_hourPast hourlast_dayPast daylast_weekPast weeklast_monthPast monthlast_yearPast year
bash
# Web search
node websearchapi.js s "MCP protocol"
# News search (past week)
node websearchapi.js news "AI" --time=last_week
# Finance search
node websearchapi.js finance "AAPL"
# Time filter (past 24 hours)
node websearchapi.js s "keyword" --time=last_day
# JSON format (recommended for parsing)
node websearchapi.js s "keyword" --json
JSON mode returns:
json
{
"success": true,
"query": "keyword",
"type": "google",
"count": 5,
"results": [
{
"title": "Result Title",
"link": "URL",
"snippet": "Summary",
"source": "Source"
}
],
"metadata": {
"totalResults": number,
"timeTaken": seconds,
"engine": "google"
}
}
bash
cd tools/websearchapi
node websearchapi.js config set-key YOUR_API_KEY
bash
# View config (Key hidden)
node websearchapi.js config
# Set API Key
node websearchapi.js config set-key YOUR_API_KEY
# Modify defaults
node websearchapi.js config set-num 10 # Default result count
node websearchapi.js config set-lang en # Default language
node websearchapi.js config set-gl us # Default country
node websearchapi.js config set-retry 5 # Retry count
bash
# Copy to new machine
scp -r ./tools/websearchapi user@new-server:/path/to/tools/
# Configure your own API Key
cd /path/to/tools/websearchapi
node websearchapi.js config set-key YOUR_API_KEY
# Test
node websearchapi.js test
node websearchapi.js configfinance "AAPL"finance "Tesla stock"config set-retry 5