返回顶部
g

google-flights-search谷歌航班搜索

Search real flight prices and schedules from Google Flights via SearchAPI.io. Use when a user asks to find flights, check prices, compare options, or search around a date range. Always pipe results through the flight-scoring skill to rank before presenting, then ALWAYS save the search via the flight-price-monitor skill for automatic price tracking. Requires SEARCHAPI_KEY in .env.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.2
安全检测
已通过
448
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

google-flights-search

Google Flights 搜索

通过 SearchAPI.io 从 Google Flights 获取实时航班数据,然后使用 flight-scoring 技能对结果进行评分和排名,最后务必通过 flight-price-monitor 技能保存搜索以进行自动价格追踪。

安装

bash
clawhub install google-flights-search

要求

  • - Python 3 — 仅使用标准库(urllib、json、argparse)。无需 pip 安装。
  • SearchAPI.io 账户 — 免费套餐包含每月 100 次请求。在此注册
  • SEARCHAPI_KEY — 注册后从 SearchAPI.io 获取 API 密钥,然后将其添加到项目根目录的 .env 文件中。OpenClaw 会自动加载。

快速参考

情况操作
用户询问航班运行 search_searchapi.py,评分结果,然后通过 flight-price-monitor 保存
往返搜索
添加 --return-date 和 --top 5 以获取返程航班详情 | | 用户说大约[日期] | 使用 --days 3,以该日期为中心 | | 用户说三月最便宜 | 使用 --days 3 并选择一个有代表性的起始日期 | | 具体日期 | 使用 --days 1(或 --days 3 以提供 ±1 天的灵活性) | | 仅直飞 | 添加 --stops 0 | | 多名乘客 | 添加 --adults N |

用法

bash

单程搜索


python {baseDir}/scripts/search_searchapi.py \
--from TLV --to LON --date 2026-03-15 --days 3 --currency USD

往返搜索,获取前 5 个结果的返程航班详情(推荐用于往返行程)

python {baseDir}/scripts/search_searchapi.py \ --from TLV --to BKK --date 2026-03-28 --return-date 2026-04-14 --top 5

所有参数

参数必需默认值描述
--from出发地 IATA 代码(例如 TLV)
--to
是 | — | 目的地 IATA 代码(例如 LON、LHR、LGW) | | --date | 是 | — | 出发日期 YYYY-MM-DD | | --return-date | 否 | — | 返程日期 YYYY-MM-DD(使其成为往返搜索) | | --days | 否 | 1 | 从 --date 开始向前搜索的天数(最大:3) | | --currency | 否 | USD | 货币代码(USD、EUR、ILS) | | --adults | 否 | 1 | 成人乘客数量 | | --stops | 否 | 任意 | 0 = 仅直飞,1 = 最多 1 次中转,2 = 最多 2 次中转 | | --class | 否 | economy | 1=经济舱,2=高级经济舱,3=商务舱,4=头等舱 | | --top | 否 | — | 自动获取前 N 个去程结果的返程航班详情。往返行程使用 --top 5。 | | --departure-token | 否 | — | 为特定去程航班获取返程航班(高级用法,很少直接需要) | | --booking-token | 否 | — | 使用特定航班的 booking_token 获取预订选项(真实航空公司/OTA 网址) |

目的地代码

Google Flights 接受:

  • - 机场代码: LHR、CDG、TLV
  • 城市代码: LON(所有伦敦机场)、PAR(所有巴黎机场)、NYC

当用户未指定首选机场时,使用城市代码。



输出格式

脚本将 JSON 输出到标准输出。

单程 / 仅去程

json
{
origin: TLV,
destination: LON,
flighttype: oneway,
daterange: { from: 2026-03-15, to: 2026-03-17, dayssearched: 3 },
currency: USD,
total_results: 24,
showing: 15,
flights: [
{
search_date: 2026-03-15,
airline: El Al,
flight_number: LY315,
origin: TLV,
destination: LHR,
departure_time: 22:00,
departure_date: 2026-03-15,
arrival_time: 01:30,
arrival_date: 2026-03-16,
duration_minutes: 270,
stops: 0,
layovers: [],
minlayoverminutes: null,
price: 1850,
overnight: true,
booking_token: WyJDa...
}
]
}

使用 --top 5 的往返行程(包含返程航班详情)

当 --top N 与 --return-date 一起使用时,前 N 个去程结果中的每一个都包含一个嵌套的 return_flight 对象,其中包含完整的返程航段详情:

json
{
origin: TLV,
destination: BKK,
flighttype: roundtrip,
return_date: 2026-04-14,
returnflightsfetchedfortop: 5,
flights: [
{
search_date: 2026-03-28,
airline: Etihad,
flight_number: EY 610,
origin: TLV,
destination: BKK,
departure_time: 07:20,
departure_date: 2026-03-28,
arrival_time: 23:25,
arrival_date: 2026-03-28,
duration_minutes: 725,
stops: 1,
layovers: [{airport: Zayed International Airport, duration_minutes: 185}],
minlayoverminutes: 185,
price: 1569,
overnight: false,
return_flight: {
airline: Etihad,
flight_number: EY 401,
origin: BKK,
destination: TLV,
departure_time: 01:05,
departure_date: 2026-04-14,
arrival_time: 08:15,
arrival_date: 2026-04-14,
duration_minutes: 670,
stops: 1,
layovers: [{airport: Zayed International Airport, duration_minutes: 150}],
minlayoverminutes: 150,
overnight: false,
price: 1569,
booking_token: EhkIAh...
}
}
]
}

重要提示: price 是往返总价(在去程和返程航班上相同)。return_flight 对象有自己的航空公司、航班号、时间、中转站和经停次数——在格式化结果时使用所有这些信息。

预订令牌查询(--booking-token)

评分后,使用每个顶级结果的 booking_token 获取真实的预订网址。

您必须传递原始搜索中使用的相同 --from、--to、--date。对于往返行程,还需传递 --return-date。

bash

单程预订查询


python {baseDir}/scripts/search_searchapi.py \
--from TLV --to LON --date 2026-03-15 \
--booking-token WyJDa...

往返预订查询 — 必须包含 --return-date

python {baseDir}/scripts/search_searchapi.py \ --from TLV --to SGN --date 2026-03-29 --return-date 2026-04-14 \ --booking-token WyJDa...

返回:

json
{
mode: booking_lookup,
total_options:

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 google-flights-search-1776282279 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 google-flights-search-1776282279 技能

通过命令行安装

skillhub install google-flights-search-1776282279

下载

⬇ 下载 google-flights-search v1.0.2(免费)

文件大小: 10.59 KB | 发布时间: 2026-4-16 17:35

v1.0.2 最新 2026-4-16 17:35
Add SearchAPI.io signup link and free tier info to requirements.

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部