mcpField
G
Google Flights (via Apify)

Google Flights (via Apify)

远程服务
apify.com地图与出行03 周前更新

关于 Google Flights (via Apify)

Google Flights (via Apify) 是 Apify Actor,可为旅行者和旅游数据工作流获取航班搜索结果,提供行程详情,并支持定期追踪票价下降。

主要功能

  1. 01航班价格与行程详情
  2. 02单程和往返搜索
  3. 03舱位、乘客与货币选项
  4. 04带价格门槛的降价追踪

适用场景

  1. 01比较航线与出行日期
  2. 02定期监测票价下降

MCP 相关

托管的 Apify MCP 服务向 MCP 客户端提供该 Actor 的航班搜索工具,也提供使用 @apify/actors-mcp-server 的本地配置说明。

配置

远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。

服务地址https://mcp.apify.com/?tools=automationnation/google-flights-scraper
一键复制安装命令
Claude CodeTerminal
Cursor.cursor/mcp.json
VS Code.vscode/mcp.json
Claude Desktopclaude_desktop_config.json
Windsurf~/.codeium/windsurf/mcp_config.json

命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。

全部服务地址
Streamable HTTPhttps://mcp.apify.com/?tools=automationnation/google-flights-scraper需要授权

工具

详细介绍

Google Flights 抓取工具和 API:价格、航空公司和时间

在 Apify 上运行

Google Flights Scraper 是一个 Apify Actor,可返回任意航线和日期的 Google Flights 结果:价格、航空公司、航班号、起飞和到达时间、时长、中途停留和转机信息、机型、座位间距和 CO2 排放量;支持单程或往返、任意舱位、乘客人数和货币,价格为每 1,000 个航班 $0.20。

**价格:**每 1,000 个航班 $0.20(Gold 及以上级别为 $0.16)· 运行:https://apify.com/automationnation/google-flights-scraper · 指南:https://retracn.github.io/automationnation-actors/google-flights-scraper/

快速了解

  • 每个航班一行:价格、航空公司、航班号、时间、时长、中途停留、转机信息、包含机型和座位间距的航段,以及相较于典型水平的 CO2 排放量。
  • 支持单程或往返、经济舱到头等舱、1–9 名成人、不经停筛选和任意货币。
  • 支持机场代码或城市名称;每次运行可查询多条航线。
  • 价格:每 1,000 个航班 $0.20(每次搜索不到一美分)。
  • 正从 Amadeus Self-Service API 迁移?开源的 amadeus-cloud 软件包(github.com/retracn/amadeus-cloud)保留了 Amadeus Node SDK 的 flightOffersSearch.get/post,并返回由此 Actor 提供的 Amadeus 格式报价。
  • 票价提醒:开启 Only fare drops 后,定时运行仅会在某条航线的最低票价低于上次运行时保存航班信息,并在每一行中记录上次价格;Max price 可添加“低于 $900”之类的阈值。

示例输入

{
  "origin": "JFK",
  "destination": "LHR",
  "departureDate": "2026-11-12"
}

航班价格提醒(票价下降)

使用 "onlyPriceDrops": true 安排搜索:仅当某条航线的最低票价低于上次运行时,才会保存该航线的航班信息,并在每一行中添加 previousCheapestPrice。添加 "maxPrice": 900 可设置价格阈值提醒。首次运行会保存所有信息(change: "first_check");票价没有下降的运行不会保存任何信息。

{ "origin": "JFK", "destination": "LHR", "departureDate": "2026-12-18", "returnDate": "2027-01-03", "maxPrice": 900, "onlyPriceDrops": true }

开箱即用:n8n 工作流:将票价下降提醒发送到 Slack · 指南:通过 API 设置航班价格提醒 · 公开任务:纽约至伦敦票价提醒

通过代码运行

REST API

curl -X POST "https://api.apify.com/v2/acts/automationnation~google-flights-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"origin": "JFK", "destination": "LHR", "departureDate": "2026-11-12"}'

Python — 参见 examples/python_example.py

# pip install apify-client
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("automationnation/google-flights-scraper").call(run_input={
  "origin": "JFK",
  "destination": "LHR",
  "departureDate": "2026-11-12"
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item.get("price"), item.get("airlines"), item.get("departure"), item.get("duration"))

JavaScript — 参见 examples/node_example.mjs

// npm install apify-client
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('automationnation/google-flights-scraper').call({
  "origin": "JFK",
  "destination": "LHR",
  "departureDate": "2026-11-12"
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const item of items) console.log(item.price, item.airlines, item.departure, item.duration);

将其与 AI Agent 搭配使用(MCP)

托管 MCP 服务 URL(适用于 Claude、ChatGPT、Cursor 和其他支持远程 MCP 的客户端):

https://mcp.apify.com?tools=automationnation/google-flights-scraper

Claude Desktop / Cursor 的本地配置 — mcp/claude_desktop_config.json:

{
  "mcpServers": {
    "google-flights-scraper": {
      "command": "npx",
      "args": [
        "-y",
        "@apify/actors-mcp-server",
        "--tools",
        "automationnation/google-flights-scraper"
      ],
      "env": {
        "APIFY_TOKEN": "YOUR_APIFY_TOKEN"
      }
    }
  }
}

常见问题

有官方的 Google Flights API 吗? 没有。Google 于 2018 年关闭了 QPX Express 航班 API。Google Flights Scraper 会将 Google Flights 搜索结果作为数据返回。

价格是按每位乘客计算的吗? 价格包含税费,涵盖所有乘客;往返行程显示往返总价。

可以向我发送航班价格提醒吗? 可以。开启 Only fare drops 并安排搜索:仅当最低票价下降时,每次运行才会保存航班信息及之前的价格;任务的 Integrations 选项卡会将其发送到 Slack、电子邮件或 Webhook。票价没有下降的运行不会保存任何信息。

更多 AutomationNation 内容


此仓库包含使用示例。抓取工具本身运行在 Apify 平台上;你需要一个免费的 Apify 账户和 API 令牌。示例采用 MIT 许可证。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。