使用 Brave API 在互联网上搜索最新信息。本工具会向 https://api.search.brave.com 发起网络请求。
此脚本需要 Brave API 密钥和 VPN 环境才能运行。需要配置 BRAVE_SEARCH_API_KEY 和 HTTP_PROXY_PORT
bash
export BRAVE_SEARCH_API_KEY="your_api_key_here"
export HTTP_PROXY_PORT="your_vpn_port_here"
bash
python3 scripts/brave_search.py --q "你的搜索词" [--country CN] [--count 20]
参数名类型必填默认值描述qstring是-搜索关键词(最多50个词)countrystring否CN搜索国家代码,如 CN, US, ALL``search_langstring否zh-hans语言偏好,如 zh-hans, en``countint否20返回结果数量限制(1-20)offsetint否0分页偏移量(0-9)safesearchstring否moderate内容过滤: off, moderate, strict``freshnessstring否-时间过滤: pd(1天内), pw(1周内), pm(1个月内), py(1年内) , YYYY-MM-DDtoYYYY-MM-DD(一定范围)text_decorationsbool否true是否在结果中保留高亮标记spellcheckbool否true是否自动纠正拼写result_filterstring否-过滤结果类型,如 web,news,videos``gogglesstring否-自定义排序规则(URL 或 内联规则)extra_snippetsbool/string否false是否获取每个结果的额外文本摘要(最多5个)
MIT License - Feel free to use and modify.