实战范例

招聘信息追踪器

按计划跟踪新招聘信息,发现新职位时发出通知

监控一组招聘页面,当符合筛选条件的新职位上线时通过 Slack / 邮件 / Discord 推送通知。同样的模式也适用于房产、市场列表,或任何"出现新条目"的信号。

Schema

{
  "type": "object",
  "properties": {
    "title":       { "type": "string", "description": "Job title" },
    "department":  { "type": "string" },
    "location":    { "type": "string", "description": "City or 'Remote'" },
    "url":         { "type": "string", "description": "Canonical job posting URL" },
    "postedAt":    { "type": "string", "description": "ISO-8601 timestamp if shown" }
  },
  "required": ["title", "url"]
}

流程

  1. 按计划(cron / GitHub Actions)把招聘页 URL 提交到 /batch/extract
  2. 完成后接收 Webhook
  3. 与上一次结果做 diff —— 对新增的 (url) 条目发出通知
  4. 通知前按职位标题 / 地点关键词过滤

实现示意

import httpx, json, pathlib

API = "https://openapi.thunderbit.com/openapi/v1"
H = {"Authorization": "Bearer YOUR_API_KEY"}
STATE = pathlib.Path("seen.json")

careers = [
    "https://example.com/careers",
    "https://example.org/jobs",
]

job = httpx.post(f"{API}/batch/extract",
                 headers=H,
                 json={"urls": careers, "schema": SCHEMA}).json()
# Poll or webhook (see Batch Job Lifecycle guide)

seen = set(json.loads(STATE.read_text())) if STATE.exists() else set()
new = []
for r in job["data"]["results"]:
    if r["status"] != "SUCCEEDED": continue
    for item in r.get("data", []):
        if item["url"] not in seen:
            new.append(item)
            seen.add(item["url"])

STATE.write_text(json.dumps(list(seen)))
notify(new)  # your Slack / email / Discord hook

小贴士

  • 跨运行持久化 seen URL —— 否则每次都会把整个列表当成新条目通知
  • 过滤要狠:if "Engineer" in item["title"] and "Remote" in item["location"]
  • 跑 4-6 小时一次的节奏 —— 招聘页不会分钟级变化

相关

这份 recipe 正在补充 GitHub Actions 工作流模板,敬请期待。