goplaces 是一个现代 Google Places API(New)命令行工具。它以人类可读格式输出为默认行为,并提供 --json 选项用于脚本化处理。
用途:通过命令行查询 Google Places API(New),完成地点文本搜索、地点详情、地点解析和评论获取,适合进行人类友好的地点查询,或为脚本提供 JSON 输出。
安装:使用 Homebrew 安装,命令为 brew install steipete/tap/goplaces。
配置:需要设置 GOOGLE_PLACES_API_KEY。可选设置 GOOGLE_PLACES_BASE_URL,用于测试或代理。
主要命令:
- 搜索:goplaces search "coffee" --open-now --min-rating 4 --limit 5
- 位置偏好:goplaces search "pizza" --lat 40.8 --lng -73.9 --radius-m 3000
- 分页:goplaces search "pizza" --page-token "NEXT_PAGE_TOKEN"
- 解析:goplaces resolve "Soho, London" --limit 5
- 详情:goplaces details <place_id> --reviews
- JSON 输出:goplaces search "sushi" --json
说明:使用 --no-color 或 NO_COLOR 可禁用 ANSI 颜色。价格等级为 0..4(免费到非常昂贵)。类型过滤只发送第一个 --type 值(该 API 只接受一个)。