メインコンテンツへスキップ
ページ監視では、すでに把握しているURLを監視します。各チェックでターゲット内のすべてのURLをスクレイピングし、前回保持されたスナップショットとの差分を取り、そのページが samechangednewremoved、または error のいずれかであることを報告します。料金ページ、変更履歴、ドキュメントページ、求人情報、ステータスページなど、小さな変更でも重要な既知のURLに適しています。 このページでは scrape ターゲットを扱います。スケジューリング、ゴールと判定、変更追跡、通知、価格設定はすべてのモニタータイプで共通です。Monitoring overview を参照してください。

ページモニターを作成する

1 つ以上の URL を明示的に指定する scrape ターゲットを持つモニターを作成します。
from firecrawl import Firecrawl

firecrawl = Firecrawl(
  # MonitorのエンドポイントにはAPI keyが必要です:
  api_key="fc-YOUR-API-KEY",
)

monitor = firecrawl.create_monitor(
    name="Hacker News AI monitor",
    schedule={"text": "every 30 minutes", "timezone": "UTC"},
    goal=(
        "Alert when a new Hacker News story related to AI enters the top 10. "
        "Ignore changes to stories that are not about AI. "
        "Do not alert on changes outside the top 10."
    ),
    targets=[
        {
            "type": "scrape",
            "urls": ["https://news.ycombinator.com"],
        }
    ],
    notification={
        "email": {
            "enabled": True,
            "recipients": ["alerts@example.com"],
            "includeDiffs": True,
        }
    },
)

print(monitor.id)
Firecrawl CLI からモニターを作成することもできます。
CLI
firecrawl monitor create --name "Hacker News AI" \
  --schedule "every 30 minutes" \
  --goal "Alert when a new Hacker News story related to AI enters the top 10. Ignore changes to stories that are not about AI. Do not alert on changes outside the top 10." \
  --page https://news.ycombinator.com

scrape ターゲット

scrape ターゲットには、type と、少なくとも 1 つの URL を含む urls 配列が必要です。スクレイピングのオプションは、内部のスクレイピングジョブにそのまま渡されます。モニター によって実行されるスクレイピングでは、maxAge のデフォルト値が 0 のため、明示的に別の maxAge を設定しない限り、チェックごとに新しいスクレイピングが実行されます。
Scrape target
{
  "type": "scrape",
  "urls": ["https://example.com/pricing"],
  "scrapeOptions": {
    "formats": ["markdown"],
    "maxAge": 0
  }
}

フィールドレベルの変更を検出する

デフォルトでは、ページモニターはページのMarkdownの差分を比較します。価格、見出し、在庫フラグ、リスト内の項目など、特定のフィールドが変更されたときだけ通知するには、ターゲットのscrapeOptionschangeTrackingフォーマットを追加します。JSONモードとMixedモードについては、変更追跡を参照してください。

共通構成

  • スケジュール: cron または自然言語で指定する実行間隔。最短 5 分です。
  • ゴールと判定: 意味のある変更があった場合にのみアラートします。
  • 通知: webhook とメールで配信します。
  • チェック結果: 各チェックと、そのページごとの差分を確認できます。
  • 料金: チェックごとに URL あたり 1 クレジット、加えて任意の判定分がかかります。