← 返回 Skills 市场
iskwang

Alaska Air

作者 iskWang · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
113
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install alaska-air
功能描述
Scrape Alaska Airlines award calendar and flight data to check miles, award availability, and prices for single-leg trips on alaskaair.com.
使用说明 (SKILL.md)

Alaska Airlines Scraper

Alaska Air uses SvelteKit SSR — all flight/award data is embedded in the raw HTML response. No Playwright or JS rendering needed.

⚠️ 目前只支援單程查詢(RT=false)。來回票請分兩次查詢。


⚠️ 日期陷阱(CRITICAL — 必讀)

用戶說「2月14日」或「2/14」→ 查整個2月,但結果只顯示有位子的日期。 絕對不能把「2/4」當「2/14」! 日期要精確對應,2027-02-042027-02-14

如果用戶指定的日期沒有位子(awardPoints: null),明確告知:

❌ 2月14日 無可用里程票
✅ 本月最近有位:2月15日 (15,000 里程)

不要默默換成別的日期後說「我找到了」。


查詢多路線/多月份 → 平行 Sub-Agents(MANDATORY)

2 個以上路線或月份,必須同時 spawn,絕不串行。

每個 sub-agent 查完後立刻用 message 工具發 Telegram — 不要等其他 agent,有結果馬上發:

# 每個 Worker sub-agent 的任務模板:
spawn model=openrouter/anthropic/claude-haiku-4-5
allowedTools=exec,read,message

"用 alaska-air skill 查 {ORIGIN}→{DEST} {YYYY}年{MM}月里程行事曆。
查完後立刻用 message 工具把結果發給用戶(Telegram to: {chat_id}),
不要等其他查詢,有結果就馬上發。
輸出格式必須含 👉 直連 URL,每個日期一個 URL,URL 單獨一行,前後各空一行。"

範例:查 3 條路線 → 同時 spawn 3 個 Worker,每個跑完就各自發 Telegram,不等彼此。


單一路線查詢

Step 1: 抓 HTML

OD= 填目標月份內任何一天即可,API 回傳整月資料。

curl -s -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36" \
  "https://www.alaskaair.com/search/calendar?O={ORIGIN}&D={DEST}&OD={YYYY-MM-01}&A=1&RT=false&RequestType=Calendar&ShoppingMethod=onlineaward&locale=en-us" \
  -o /tmp/alaska_{ORIGIN}_{DEST}_{YYYYMM}.html

Step 2: 錯誤處理

抓完後先確認 HTML 是否含有效資料:

if ! grep -q 'awardPoints' /tmp/alaska_{ORIGIN}_{DEST}_{YYYYMM}.html; then
  echo "抓取失敗:HTML 不含 awardPoints,可能被封鎖或路線無效"
  exit 1
fi

若抓取失敗,直接回報用戶「抓取失敗,請稍後再試」,不繼續執行。

Step 3: 提取資料(含直連 URL)

將以下內容寫入 /tmp/parse_alaska.py,再執行:

# /tmp/parse_alaska.py
import re, json, sys

def scrape_alaska(origin, dest, yyyymm, adults=1):
    html = open(f'/tmp/alaska_{origin}_{dest}_{yyyymm}.html').read()
    pat = r'\{date:"([^"]+)",price:([\d.]+|null),awardPoints:(\d+|null),isDiscounted:(true|false),flightSegments:\[.*?\],solutionId:"([^"]*)"\}'
    results = []
    for date, price, miles, disc, sol in re.findall(pat, html):
        avail = miles != 'null'
        entry = {
            'date': date,
            'available': avail,
            'miles': int(miles) if avail else None,
            'price_usd': float(price) if avail else None,
            'discounted': disc == 'true',
        }
        if avail:
            entry['book_url'] = (
                f"https://www.alaskaair.com/search/?O={origin}&D={dest}"
                f"&D1={date}&A={adults}&RT=false&ShoppingMethod=onlineaward&locale=en-us"
            )
        results.append(entry)
    # 按日期排序(保留所有日期,含 N/A)
    return sorted(results, key=lambda x: x['date'])

origin, dest, yyyymm = sys.argv[1], sys.argv[2], sys.argv[3]
results = scrape_alaska(origin, dest, yyyymm)
available = [r for r in results if r['available']]
print(json.dumps(available, indent=2, ensure_ascii=False))

執行方式:

python3 /tmp/parse_alaska.py {ORIGIN} {DEST} {YYYYMM}

例如:python3 /tmp/parse_alaska.py KIX TPE 202702


輸出格式(MANDATORY)

每次查詢完成後立刻發 Telegram(用 message 工具),格式:

📅 KIX → TPE | 2027年2月
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ 有位日期(按里程排序):

2月4日 (四)   7,500 里程 + $48.3  ⭐

👉 https://www.alaskaair.com/search/?O=KIX&D=TPE&D1=2027-02-04&A=1&RT=false&ShoppingMethod=onlineaward&locale=en-us

2月2日 (二)  10,000 里程 + $45.1

👉 https://www.alaskaair.com/search/?O=KIX&D=TPE&D1=2027-02-02&A=1&RT=false&ShoppingMethod=onlineaward&locale=en-us

(若用戶指定日期無位)
❌ 2月14日 無可用里程票

規則:

  • 按里程數由少到多排序
  • 最便宜加 ⭐
  • 每個日期必須有 👉 直連 URL,URL 單獨一行,前後各加空行
  • 用戶指定日期無位時明確說 ❌,不要偷換成其他日期
  • 查完即發,不等其他 agent
  • Telegram chat ID 由呼叫方提供,不寫死在此

URL 參數

O=KIX          # 出發 IATA
D=TPE          # 目的地 IATA
D1=2027-02-04  # 指定日期(直連訂票頁)
OD=2027-02-01  # 月份任意日(行事曆 API,回傳整月)
A=1            # 大人數
RT=false       # 單程
ShoppingMethod=onlineaward
locale=en-us

已知開放 API

curl https://www.alaskaair.com/search/api/citySearch/getAllAirports
curl https://www.alaskaair.com/search/api/discounts
curl https://www.alaskaair.com/account/token
安全使用建议
What to consider before installing: 1) The scraping logic (curl + local Python parsing) is reasonable for this purpose, but the skill also requires spawning parallel sub-agents that target a named external model provider and to immediately send results via the platform 'message' tool. Ask the author why external models are required for parallelism and how the platform will supply any needed API keys—no credentials are declared in the skill metadata. 2) Verify how the agent's 'message' tool is authorized: who provides the Telegram bot token and who can supply chat_id values? Ensure chat_id is supplied at call time and not hardcoded. 3) Expect runtime network activity beyond Alaskaair (calls to external model endpoints and the messaging endpoint); if you want tighter control, request removal of the mandatory sub-agent spawn behavior and require explicit user approval before sending messages. 4) Test in a controlled environment (rate-limited) to avoid accidental mass requests and review Alaskaair's Terms of Service regarding scraping. 5) If you need a safer install, ask the maintainer to remove the model spawn template or make external model usage optional and to declare any required API keys in the skill metadata so you can review and control them.
功能分析
Type: OpenClaw Skill Name: alaska-air Version: 1.0.0 The skill is a functional scraper for Alaska Airlines award flight data. It uses curl to fetch HTML from alaskaair.com and a Python script (written to /tmp/parse_alaska.py) to extract flight availability and pricing using regex. The instructions include a workflow for parallelizing queries via sub-agents and reporting results to the user via a messaging tool (Telegram), which aligns with the stated purpose of a travel assistant. No evidence of data exfiltration, credential theft, or malicious execution was found.
能力评估
Purpose & Capability
The core scraping steps (curl the calendar endpoint, parse HTML with Python) are coherent with the skill's purpose. However, the SKILL.md mandates spawning separate sub-agents using a specific external model (openrouter/anthropic/claude-...) for parallel queries; parallelism could be implemented locally and does not inherently require external models. The requirement to spawn a named external model is disproportionate and unexplained.
Instruction Scope
Instructions tell the agent to write files under /tmp, run curl and python3 (consistent), and—critically—to immediately send each sub-agent's results via the 'message' tool to a Telegram chat_id. Mandating immediate, independent sends and forcing a specific message format increases the chance of unexpected data exfiltration or spam. The spawn template grants broad autonomy to sub-agents (exec, read, message).
Install Mechanism
This is an instruction-only skill with no install spec and no code files. That minimizes install-time risk (nothing will be downloaded or written except temporary /tmp files during runtime).
Credentials
The skill declares no required environment variables or credentials, yet instructs spawning an OpenRouter/Anthropic model (which would normally require API keys) and sending Telegram messages (which often requires a bot token or platform messaging capability). The lack of declared credentials or explanation for how the 'message' tool is authorized is an inconsistency.
Persistence & Privilege
The skill does not request always:true or any system-wide persistence. It writes temporary files under /tmp and uses allowed tools; these behaviors are expected for a scraper. The mandatory spawning of autonomous sub-agents increases runtime reach but is not itself a privilege flag—it's an operational risk when combined with the other inconsistencies.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install alaska-air
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /alaska-air 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Alaska Airlines Award Scraper initial release: - Enables scraping of Alaska Airlines award calendar and flight data via HTML (no JavaScript rendering required). - Supports single-route, one-way mileage availability searches; each query covers a full month. - Parallel processing for multi-route or multi-month queries, with immediate Telegram messaging for each result. - Precise date handling and clear feedback if no award seats are available on the specified date. - Includes direct booking URLs and formatted Telegram-ready output for user convenience. - Provides sample Bash and Python snippets for scraping and parsing award data.
元数据
Slug alaska-air
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 0
历史版本数 1
常见问题

Alaska Air 是什么?

Scrape Alaska Airlines award calendar and flight data to check miles, award availability, and prices for single-leg trips on alaskaair.com. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 113 次。

如何安装 Alaska Air?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install alaska-air」即可一键安装,无需额外配置。

Alaska Air 是免费的吗?

是的,Alaska Air 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Alaska Air 支持哪些平台?

Alaska Air 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Alaska Air?

由 iskWang(@iskwang)开发并维护,当前版本 v1.0.0。

💬 留言讨论