票价对比工具

ticket-price-compare

by amurtiger01

This skill should be used when the user wants to compare and search for flight or train ticket prices across multiple platforms. It supports both domestic (China) and international routes, fetches real-time train availability via 12306, generates direct search links for all major booking platforms and airline official websites, provides WeChat mini program quick links for mobile search, and highlights discount conditions. For flight prices, it attempts web scraping first (no API key needed), then falls back to Tequila/Amadeus API for existing key holders. Trigger scenarios include: searching for cheap flights, comparing train ticket prices, finding international flight deals, looking for the best ticket booking platform, or asking about ticket discount conditions.

4.5k搜索与获取未扫描2026年4月27日

安装

claude skill add --url https://github.com/openclaw/skills

文档

Ticket Price Compare - Multi-Platform Ticket Price Comparison

Overview

This skill enables real-time comparison of flight and train ticket prices. It fetches real-time train availability via 12306 (no API key needed), and attempts to scrape flight prices from Ctrip (no API key needed). It also generates direct search links for all major booking platforms and WeChat mini program quick links for convenient mobile search. Tequila/Amadeus APIs are available as optional fallbacks for users who already have keys. Discount conditions and restrictions are clearly listed separately.

Data Sources

Ctrip Web Scraping (Primary, No API Key Needed)

  • Scrapes public Ctrip flight search pages for price data
  • No registration or API key required - works out of the box
  • Note: Ctrip renders pages via JavaScript, so scraping may not always return prices. In that case, platform links are provided for manual search.

12306 (Train Tickets, No API Key Needed)

  • Uses 12306 public endpoint for real-time train availability
  • Supports major Chinese cities with station code auto-mapping

Optional APIs (For Existing Key Holders Only)

  • Kiwi.com Tequila API: If TEQUILA_API_KEY is set (registration may no longer be available)
  • Amadeus API: If AMADEUS_CLIENT_ID + AMADEUS_CLIENT_SECRET are set (registration is closed)
  • These are used as fallbacks only when web scraping returns no results

Core Capabilities

1. Flight Ticket Search

bash
python scripts/ticket_search.py "<departure>" "<arrival>" "<date>" flight
  • Domestic: python scripts/ticket_search.py "Beijing" "Shanghai" "2026-05-01" flight
  • International: python scripts/ticket_search.py "Shanghai" "Tokyo" "2026-06-15" flight

Data sources (in order of priority):

  1. Ctrip Web Scraping (no API key, may return prices or flight info)
  2. Tequila API (if API key configured)
  3. Amadeus API (if API keys configured)

Covered domestic platforms: Ctrip, Qunar, Fliggy, Tongcheng, Tuniu

Covered international platforms: Skyscanner, Google Flights, Kayak, Momondo, Expedia, Booking.com

Covered airline official sites: 10 Chinese + 13 international airlines

2. Train Ticket Search with Real-Time Availability

bash
python scripts/ticket_search.py "<departure>" "<arrival>" "<date>" train

Real-time data from 12306: Returns actual train schedules with:

  • Train code & type (High-Speed/EMU/Express/Fast)
  • Departure/arrival stations & times
  • Duration
  • Available seat types & counts (Business Class/First Class/Second Class/Hard Sleeper/Hard Seat etc.)

3. Combined Search (Flight + Train)

bash
python scripts/ticket_search.py "<departure>" "<arrival>" "<date>" all

Train results are automatically excluded for international routes.

Output Sections

The script generates structured output with these sections (in order):

  1. Route Summary - Departure, arrival, date, route type
  2. Data Source Status - Whether scraping/APIs returned live data
  3. Real-Time Flight Prices - Table of flight offers with prices (if available)
  4. Transfer Details - Multi-segment flight details (if any transfers)
  5. Flight Discount Conditions - Refund/change rules, baggage limits, cabin restrictions
  6. Real-Time Train Info - Table of actual trains with seat availability (if domestic)
  7. Train Discount Conditions - Student tickets, child tickets, change rules
  8. Platform Links - Direct search URLs for all booking platforms
  9. Airline Official Sites - Direct links to airline websites
  10. WeChat Mini Program Quick Links - Mobile H5 links + WeChat mini program search tips for Ctrip/Fliggy/Tongcheng/Qunar and major airlines
  11. Search Tips - Route-specific advice

Discount Conditions

Always include the dedicated "Discount Conditions / Restrictions" section. Reference references/platforms_guide.md for detailed per-platform discount conditions. Load this file when:

  • User asks about specific discount conditions
  • Presenting results that include discounted fares
  • User asks which platform has the best deals for their situation

Workflow

  1. Collect query parameters: Get departure city, arrival city, and travel date. If date not specified, ask. Default ticket type to "all".

  2. Execute search: Run scripts/ticket_search.py with the parameters.

  3. Present results: Show the complete output including:

    • Real-time prices (if available from scraping or API)
    • All platform links for comparison
    • Discount conditions section
    • Search tips
  4. If no flight prices returned: Inform the user that real-time flight prices could not be fetched automatically, and recommend clicking the platform links to compare prices manually. Mention that 12306 train data is always available for domestic routes.

Date Flexibility

If a user asks for "cheapest dates" or "price trends":

  • Run the script with multiple date parameters to compare
  • For domestic flights: Also suggest Ctrip/Qunar price calendar features
  • For international flights: Suggest Skyscanner "cheapest month" or Google Flights date grid

Important Notes

  • Primary method: Web scraping (Ctrip) - no API key needed, but may not always work due to JavaScript rendering
  • Fallback APIs: Tequila/Amadeus - only for users who already have keys; registration is closed for new users
  • Without any flight data: Platform search links are always provided (users click to see prices)
  • 12306 train data is always real-time (no API key needed)
  • SSL verification: Only disabled for 12306 endpoints (known certificate chain issues); all other connections use full TLS verification
  • Prices vary in real-time; recommend checking 2-3 platforms for confirmation
  • Airline official websites sometimes offer exclusive prices not available on OTA platforms
  • Always remind users about potential discount conditions before booking

相关 Skills

谷歌视频工具

by bwbernardweston18

热门

>

搜索与获取
未扫描4.5k
热门

股票投研9点分析框架,覆盖基本面/财务/竞品/估值/宏观/情绪等维度

搜索与获取
未扫描4.5k

SEO审计工具

by amdf01-debug

热门

搜索与获取
未扫描4.5k

相关 MCP 服务

by Anthropic

热门

Puppeteer 是让 Claude 自动操作浏览器进行网页抓取和测试的 MCP 服务器。

这个服务器解决了手动编写 Puppeteer 脚本的繁琐问题,适合需要自动化网页交互的开发者,比如抓取动态内容或做端到端测试。不过,作为参考实现,它可能缺少生产级的安全防护,建议在可控环境中使用。

搜索与获取
86.1k

Brave 搜索

编辑精选

by Anthropic

热门

Brave Search 是让 Claude 直接调用 Brave 搜索 API 获取实时网络信息的 MCP 服务器。

如果你想让 AI 助手帮你搜索最新资讯或技术文档,这个工具能绕过传统搜索的限制,直接返回结构化数据。特别适合需要实时信息的开发者,比如查 API 更新或竞品动态。不过它依赖 Brave 的 API 配额,高频使用可能受限。

搜索与获取
86.1k

网页抓取

编辑精选

by Anthropic

热门

Fetch 是 MCP 官方参考服务器,让 AI 能抓取网页并转为 Markdown 格式。

这个服务器解决了 AI 直接处理网页内容时格式混乱的问题,适合需要让 Claude 分析在线文档或新闻的开发者。不过作为参考实现,它缺乏生产级的安全配置,你得自己处理反爬虫和隐私风险。

搜索与获取
86.1k

评论