flights
通过 Google Flights 搜索航班。查找直达/转机航班,按时间和舱位筛选,获取预订链接。支持城市名称(纽约、伦敦、东京)以及自动多机场搜索。无需 API 密钥。
安装 / 下载方式
TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~brennerspear-flights-searchcURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~brennerspear-flights-search/file -o brennerspear-flights-search.md# Flight Search Search real-time flight schedules and prices via Google Flights data. ## Prerequisites - **Python 3.9+** - **[uv](https://docs.astral.sh/uv/)** (recommended) — install with `curl -LsSf https://astral.sh/uv/install.sh | sh` The `flights-search` CLI is bundled at `scripts/flights-search` in this skill directory. The `fast-flights` library is installed automatically on first run via `uvx` (cached after that). Or install manually: `pip install fast-flights` ## CLI Usage ```bash uvx --with fast-flights python3 scripts/flights-search <origin> <destination> <date> [options] ``` Origin and destination accept **IATA codes** (JFK, LAX) or **city names** (NYC, London, Tokyo). City names automatically search all airports in that metro area. ### Examples ```bash # Search all NYC airports to LAX flights-search NYC LAX 2026-03-15 # Nonstop flights from NYC to Berlin flights-search NYC Berlin 2026-03-15 --nonstop # Evening departures only flights-search JFK LHR 2026-03-15 --after 17 --before 22 # Business class flights-search NYC London 2026-03-15 --class business # Multiple passengers with booking link flights-search SF Tokyo 2026-04-01 --passengers 2 --link ``` ### Options | Option | Description | |--------|-------------| | `--nonstop` | Nonstop flights only | | `--all-stops` | Show all flights regardless of stops | | `--after HH` | Depart after hour (24h format) | | `--before HH` | Depart before hour (24h format) | | `--class` | Cabin: economy, premium, business, first | | `--passengers N` | Number of travelers (default: 1) | | `--link` | Print Google Flights URL | ### Supported City Names When you use a city name, the CLI searches all airports in that metro area: | City | Airports | |------|----------| | NYC / New York | JFK, EWR, LGA | | LA / Los Angeles | LAX, BUR, LGB, ONT, SNA | | SF / San Francisco | SFO, OAK, SJC | | Chicago | ORD, MDW | | DC / Washington | DCA, IAD, BWI | | London | LHR, LGW, STN, LTN, LCY | | Paris | CDG, ORY | | Tokyo | NRT, HND | | Toronto | YYZ, YTZ | 60+ metro areas supported. Use any IATA code directly for airports not in the list. ## Default Behavior By default, the CLI shows only flights with the **minimum stops available**: - If nonstops exist → shows only nonstops - If no nonstops → shows only 1-stop flights - Use `--all-stops` to see everything ## Output ``` Searching from NYC: JFK, EWR, LGA Route Depart Arrive Airline Price Duration ------------------------------------------------------------------------------------------------------------ EWR→LAX 6:00 AM on Sat, Mar 7 9:07 AM on Sat, Mar 7 United $289 6 hr 7 min EWR→LAX 12:00 PM on Sat, Mar 7 3:14 PM on Sat, Mar 7 United $289 6 hr 14 min JFK→LAX 8:00 AM on Sat, Mar 7 11:30 AM on Sat, Mar 7 Delta $304 5 hr 30 min 3 flight(s) found. ``` ## Notes - Date format: `YYYY-MM-DD` - Airport codes: Standard IATA codes (JFK, LAX, LHR, etc.) - Prices are in USD - Times shown in local airport timezone - No API key required — uses Google Flights data via reverse-engineered protobuf API - Some routes may return price-only results (missing departure/arrival times) due to upstream parsing limitations ## Data Source Uses Google Flights data via the [`fast-flights`](https://github.com/AWeirdDev/flights) Python package. --- ## 中文说明 # 航班搜索 通过 Google Flights 数据搜索实时航班时刻表和价格。 ## 前置条件 - **Python 3.9+** - **[uv](https://docs.astral.sh/uv/)**(推荐)—— 使用 `curl -LsSf https://astral.sh/uv/install.sh | sh` 安装 `flights-search` CLI 已捆绑在该 skill 目录下的 `scripts/flights-search` 中。 `fast-flights` 库会在首次运行时通过 `uvx` 自动安装(之后会被缓存)。也可以手动安装:`pip install fast-flights` ## CLI 用法 ```bash uvx --with fast-flights python3 scripts/flights-search <origin> <destination> <date> [options] ``` 出发地和目的地接受 **IATA 代码**(JFK、LAX)或 **城市名称**(NYC、London、Tokyo)。城市名称会自动搜索该都市区域内的所有机场。 ### 示例 ```bash # Search all NYC airports to LAX flights-search NYC LAX 2026-03-15 # Nonstop flights from NYC to Berlin flights-search NYC Berlin 2026-03-15 --nonstop # Evening departures only flights-search JFK LHR 2026-03-15 --after 17 --before 22 # Business class flights-search NYC London 2026-03-15 --class business # Multiple passengers with booking link flights-search SF Tokyo 2026-04-01 --passengers 2 --link ``` ### 选项 | 选项 | 说明 | |--------|-------------| | `--nonstop` | 仅显示直达航班 | | `--all-stops` | 显示所有航班,不限中转次数 | | `--after HH` | 在指定小时之后出发(24 小时制) | | `--before HH` | 在指定小时之前出发(24 小时制) | | `--class` | 舱位:economy、premium、business、first | | `--passengers N` | 旅客人数(默认:1) | | `--link` | 打印 Google Flights URL | ### 支持的城市名称 当你使用城市名称时,CLI 会搜索该都市区域内的所有机场: | 城市 | 机场 | |------|----------| | NYC / New York | JFK, EWR, LGA | | LA / Los Angeles | LAX, BUR, LGB, ONT, SNA | | SF / San Francisco | SFO, OAK, SJC | | Chicago | ORD, MDW | | DC / Washington | DCA, IAD, BWI | | London | LHR, LGW, STN, LTN, LCY | | Paris | CDG, ORY | | Tokyo | NRT, HND | | Toronto | YYZ, YTZ | 支持 60 多个都市区域。对于列表中未包含的机场,可直接使用任意 IATA 代码。 ## 默认行为 默认情况下,CLI 仅显示**可用的最少中转次数**的航班: - 如果存在直达航班 → 仅显示直达航班 - 如果没有直达航班 → 仅显示 1 次中转的航班 - 使用 `--all-stops` 可查看全部航班 ## 输出 ``` Searching from NYC: JFK, EWR, LGA Route Depart Arrive Airline Price Duration ------------------------------------------------------------------------------------------------------------ EWR→LAX 6:00 AM on Sat, Mar 7 9:07 AM on Sat, Mar 7 United $289 6 hr 7 min EWR→LAX 12:00 PM on Sat, Mar 7 3:14 PM on Sat, Mar 7 United $289 6 hr 14 min JFK→LAX 8:00 AM on Sat, Mar 7 11:30 AM on Sat, Mar 7 Delta $304 5 hr 30 min 3 flight(s) found. ``` ## 注意事项 - 日期格式:`YYYY-MM-DD` - 机场代码:标准 IATA 代码(JFK、LAX、LHR 等) - 价格以美元(USD)计 - 时间以机场当地时区显示 - 无需 API 密钥 —— 通过逆向工程的 protobuf API 使用 Google Flights 数据 - 由于上游解析的限制,某些航线可能仅返回价格结果(缺少出发/到达时间) ## 数据来源 通过 [`fast-flights`](https://github.com/AWeirdDev/flights) Python 包使用 Google Flights 数据。