Google Flights
Flight search with flexible dates, smart filters, connection scoring, and price tracking.
Quick Start
CODEBLOCK0
Search
Basic Usage
CODEBLOCK1
Date Formats
Natural language supported:
- -
tomorrow, INLINECODE1 - INLINECODE2 , INLINECODE3
- INLINECODE4 ,
March 15, INLINECODE6 - INLINECODE7 (ISO format)
Filters
| Flag | Short | Description |
|---|
| INLINECODE8 | INLINECODE9 | Search ±N days around date |
| INLINECODE10 |
-n | Nonstop flights only |
|
--max-price |
-m | Maximum price |
|
--depart-after | | Depart after time (8am, 14:00) |
|
--arrive-before | | Arrive before time (6pm, 18:00) |
|
--seat |
-s | economy, premium-economy, business, first |
|
--adults |
-a | Number of adults (default: 1) |
|
--children |
-c | Number of children |
|
--return |
-r | Return date for round-trip |
Output
| Flag | Description |
|---|
| INLINECODE24 | Show top N results (default: 5) |
| INLINECODE25 |
Sort by: price (default), score, duration |
|
--show-scores | Show connection quality breakdown |
|
--json | JSON output |
Examples
CODEBLOCK2
Price Tracking
Track specific flights and get alerts on price changes.
CODEBLOCK3
Route Watching
Monitor regular routes (e.g., commute between two cities).
CODEBLOCK4
Cron Integration
Set up daily price checks:
CODEBLOCK5
Connection Quality Scoring
Flights scored 0-100 based on:
| Factor | Impact |
|---|
| Nonstop flight | +15 |
| Preferred airline |
+10 |
| Tight connection (<45min) | -30 |
| Long layover (>4hr) | -5 to -25 |
| Problematic connection airport | -10 to -20 |
| Winter weather risk (ORD, EWR, etc.) | -15 |
| Red-eye (depart after 10pm) | -15 |
| Early departure (<6am) | -10 |
| Avoided airline | -25 |
Use --show-scores to see breakdown or --sort score to prioritize quality.
Configuration
Copy config.example.json to config.json and customize:
CODEBLOCK6
Setup
CODEBLOCK7
Data Files
- -
~/clawd/memory/flight-tracking.json — Tracked flights - INLINECODE33 — Price history
- INLINECODE34 — Watched routes
Google Flights
支持灵活日期、智能筛选、转机评分和价格追踪的航班搜索。
快速开始
bash
cd ~/clawd/skills/google-flights
source .venv/bin/activate
基础搜索
./scripts/search.py LAX JFK tomorrow
灵活日期 — 查找最便宜日期
./scripts/search.py LAX JFK apr 15 --flex 3
直飞且低于500美元
./scripts/search.py SFO ORD next friday --nonstop --max-price 500
监控航线价格变动
./scripts/watch-route.py add LAX JFK --alert-below 350
./scripts/watch-route.py watch
搜索
基本用法
bash
./scripts/search.py <出发地> <目的地> <日期> [选项]
日期格式
支持自然语言:
- - tomorrow、today
- next friday、next week
- mar 15、March 15、3/15
- 2026-04-15(ISO格式)
筛选条件
| 标志 | 简写 | 说明 |
|---|
| --flex N | -f | 在日期前后±N天搜索 |
| --nonstop |
-n | 仅直飞航班 |
| --max-price | -m | 最高价格 |
| --depart-after | | 出发时间之后(8am、14:00) |
| --arrive-before | | 到达时间之前(6pm、18:00) |
| --seat | -s | 经济舱、高级经济舱、商务舱、头等舱 |
| --adults | -a | 成人数量(默认:1) |
| --children | -c | 儿童数量 |
| --return | -r | 往返返程日期 |
输出
| 标志 | 说明 |
|---|
| --top N | 显示前N个结果(默认:5) |
| --sort |
排序方式:价格(默认)、评分、时长 |
| --show-scores | 显示转机质量详情 |
| --json | JSON格式输出 |
示例
bash
在一周范围内查找最便宜日期
./scripts/search.py LAX JFK apr 10 --flex 7 --nonstop
上午出发,商务舱
./scripts/search.py SFO LHR may 1 --seat business --depart-after 8am
家庭出行,按转机质量排序
./scripts/search.py DEN MCO jun 15 -a 2 -c 2 --sort score --show-scores
往返低于800美元
./scripts/search.py SEA LAX apr 1 --return apr 8 --max-price 800
价格追踪
追踪特定航班并在价格变动时获取提醒。
bash
追踪特定航班
./scripts/track.py add LAX JFK 2026-05-15 --alert-below 400
追踪往返航班
./scripts/track.py add LAX JFK may 1 --return may 8 -a 350
检查所有追踪的航班
./scripts/track.py check
查看价格历史
./scripts/track.py history LAX-JFK-2026-05-15
列出/移除
./scripts/track.py list
./scripts/track.py remove LAX-JFK-2026-05-15
航线监控
监控常规航线(例如,两个城市间的通勤)。
bash
添加监控航线
./scripts/watch-route.py add LAX JFK --alert-below 400
检查所有监控航线
./scripts/watch-route.py watch
列出监控航线
./scripts/watch-route.py list
移除航线
./scripts/watch-route.py remove LAX-JFK
Cron集成
设置每日价格检查:
bash
openclaw cron add \
--name 航班价格监控 \
--cron 0 9 * \
--tz America/New_York \
--session isolated \
--message cd ~/clawd/skills/google-flights && source .venv/bin/activate && ./scripts/watch-route.py watch。仅当价格低于阈值时提醒用户。
转机质量评分
航班评分0-100分,基于以下因素:
+10 |
| 转机时间过紧(<45分钟) | -30 |
| 长时间停留(>4小时) | -5至-25 |
| 问题转机机场 | -10至-20 |
| 冬季天气风险(ORD、EWR等) | -15 |
| 红眼航班(晚上10点后出发) | -15 |
| 过早出发(早上6点前) | -10 |
| 避免乘坐的航空公司 | -25 |
使用--show-scores查看详情,或使用--sort score优先考虑质量排序。
配置
复制config.example.json为config.json并进行自定义:
json
{
preferred_airlines: [United, Delta],
avoid_airlines: [Spirit],
prefer_nonstop: true,
maxlayoverhours: 4,
minlayoverminutes: 45,
home_airports: [LAX, JFK],
loyalty_programs: {
united_mileageplus: gold
}
}
设置
bash
cd ~/clawd/skills/google-flights
uv venv && source .venv/bin/activate && uv pip install fast-flights
chmod +x scripts/*.py
cp config.example.json config.json # 然后编辑
数据文件
- - ~/clawd/memory/flight-tracking.json — 追踪的航班
- ~/clawd/memory/flight-prices.jsonl — 价格历史
- ~/clawd/memory/route-watch-state.json — 监控的航线