Automate Trip.com flight and hotel searches, order management, price tracking, and QR code login with Playwright-based browser automation.
携程网 (Trip.com / Ctrip.com) 自动化工具,支持机票搜索、酒店搜索、订单管理和价格监控。
# 安装 Python 依赖(playwright 等)
pip install -r requirements.txt
# 安装 Playwright 浏览器
playwright install chromium
trip flight <出发地> <目的地> <日期>
示例:
trip flight 北京 上海 2026-03-15
trip flight 上海 深圳 2026-03-20 --json
trip hotel <城市> <入住日期> <离店日期>
示例:
trip hotel 上海 2026-03-15 2026-03-17
trip hotel 北京 2026-04-01 2026-04-03 --json
trip order
trip order --json
trip price <链接>
示例:
trip price https://www.trip.com/hotels/shanghai-hotel/12345/
trip login
--headless: 无头模式运行(不显示浏览器窗口)--json: 以 JSON 格式输出结果本地数据存储位置: ~/.openclaw/data/ecommerce/
| 文件 | 用途 | 安全说明 |
|---|---|---|
auth.db | 登录会话信息 | SQLite 数据库,本地存储 |
ecommerce.db | 缓存和价格历史 | 不含敏感信息 |
trip_profile/ | 浏览器配置文件 | Playwright 用户数据目录 |
trip_cookies.json | Cookie 文件 | 可选,用于保持登录状态 |
安全提示:
~/.openclaw/data/ecommerce/ 目录即可ecommerce_core 模块(代码自包含,无外部模块依赖)代码层面: 本 skill 包含完整的 ecommerce_core/ 框架代码,不依赖外部 Python 模块导入。
运行时层面: 需要安装以下 Python 包(见 requirements.txt):
playwright>=1.40.0 - 浏览器自动化aiohttp>=3.9.0 - HTTP 客户端pillow>=10.0.0 - 图像处理playwright install chromium 安装浏览器--headless 模式在后台运行如果页面结构发生变化,可能需要更新 CSS 选择器。检查 Trip.com 网站的最新 HTML 结构。
~/.openclaw/data/ecommerce/trip_profile/ 目录后重试清除缓存:
rm ~/.openclaw/data/ecommerce/ecommerce.db
ZIP package — ready to use