flights

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Flight Search

航班搜索

Search real-time flight schedules and prices via Google Flights data.
通过Google Flights数据搜索实时航班时刻表和价格。

Prerequisites

前置条件

bash
pip install fast-flights
The
flights-search
CLI is bundled at
scripts/flights-search
in this skill directory.
bash
pip install fast-flights
flights-search
CLI工具已捆绑在本技能目录下的
scripts/flights-search
路径中。

CLI Usage

CLI使用方法

bash
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.
bash
flights-search <origin> <destination> <date> [options]
出发地和目的地支持IATA代码(如JFK、LAX)或城市名称(如NYC、伦敦、东京)。使用城市名称时,会自动搜索该都会区的所有机场。

Examples

示例

bash
undefined
bash
undefined

Search all NYC airports to LAX

搜索纽约所有机场飞往洛杉矶的航班

flights-search NYC LAX 2026-03-15
flights-search NYC LAX 2026-03-15

Nonstop flights from NYC to Berlin

纽约直飞柏林的航班

flights-search NYC Berlin 2026-03-15 --nonstop
flights-search NYC Berlin 2026-03-15 --nonstop

Evening departures only

仅显示晚间出发的航班

flights-search JFK LHR 2026-03-15 --after 17 --before 22
flights-search JFK LHR 2026-03-15 --after 17 --before 22

Business class

商务舱航班

flights-search NYC London 2026-03-15 --class business
flights-search NYC London 2026-03-15 --class business

Multiple passengers with booking link

多人出行并获取预订链接

flights-search SF Tokyo 2026-04-01 --passengers 2 --link
undefined
flights-search SF Tokyo 2026-04-01 --passengers 2 --link
undefined

Options

选项

OptionDescription
--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
选项说明
--nonstop
仅显示直飞航班
--all-stops
显示所有航班,无论中转次数
--after HH
仅显示指定小时后出发的航班(24小时制)
--before HH
仅显示指定小时前出发的航班(24小时制)
--class
客舱等级:economy(经济舱)、premium(超级经济舱)、business(商务舱)、first(头等舱)
--passengers N
出行人数(默认:1人)
--link
打印Google Flights的URL链接

Supported City Names

支持的城市名称

When you use a city name, the CLI searches all airports in that metro area:
CityAirports
NYC / New YorkJFK, EWR, LGA
LA / Los AngelesLAX, BUR, LGB, ONT, SNA
SF / San FranciscoSFO, OAK, SJC
ChicagoORD, MDW
DC / WashingtonDCA, IAD, BWI
LondonLHR, LGW, STN, LTN, LCY
ParisCDG, ORY
TokyoNRT, HND
TorontoYYZ, YTZ
60+ metro areas supported. Use any IATA code directly for airports not in the list.
使用城市名称时,CLI会搜索该都会区的所有机场:
城市机场
NYC / 纽约JFK, EWR, LGA
LA / 洛杉矶LAX, BUR, LGB, ONT, SNA
SF / 旧金山SFO, OAK, SJC
芝加哥ORD, MDW
DC / 华盛顿DCA, IAD, BWI
伦敦LHR, LGW, STN, LTN, LCY
巴黎CDG, ORY
东京NRT, HND
多伦多YYZ, YTZ
支持60+个都会区。对于列表外的机场,可直接使用对应的IATA代码。

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
默认情况下,CLI仅显示中转次数最少的航班:
  • 若存在直飞航班 → 仅显示直飞航班
  • 若无直飞航班 → 仅显示1次中转的航班
  • 使用
    --all-stops
    可查看所有航班

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.
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
  • 日期格式:
    YYYY-MM-DD
  • 机场代码:标准IATA代码(如JFK、LAX、LHR等)
  • 价格以美元为单位
  • 时间显示为当地机场时区
  • 无需API密钥 — 通过逆向工程的protobuf API获取Google Flights数据
  • 由于上游解析限制,部分航线可能仅返回价格结果(缺少出发/到达时间)

Data Source

数据来源

Uses Google Flights data via the
fast-flights
Python package.
通过Python包
fast-flights
获取Google Flights数据。