ページ監視では、すでに把握しているURLを監視します。各チェックでターゲット内のすべてのURLをスクレイピングし、前回保持されたスナップショットとの差分を取り、そのページが same、changed、new、removed、または 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)
import Firecrawl from "@mendable/firecrawl-js";
const firecrawl = new Firecrawl({
// モニターのエンドポイントにはAPIキーが必要です:
apiKey: "fc-YOUR-API-KEY",
});
const monitor = await firecrawl.createMonitor({
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.",
notification: {
email: {
enabled: true,
recipients: ["alerts@example.com"],
includeDiffs: true,
},
},
targets: [
{
type: "scrape",
urls: ["https://news.ycombinator.com"],
},
],
});
console.log(monitor.id);
curl -s -X POST "https://api.firecrawl.dev/v2/monitor" \
-H "Authorization: Bearer $FIRECRAWL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"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.",
"notification": {
"email": {
"enabled": true,
"recipients": ["alerts@example.com"],
"includeDiffs": true
}
},
"targets": [
{
"type": "scrape",
"urls": ["https://news.ycombinator.com"]
}
]
}'
Firecrawl 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 ターゲットには、type と、少なくとも 1 つの URL を含む urls 配列が必要です。スクレイピングのオプションは、内部のスクレイピングジョブにそのまま渡されます。モニター によって実行されるスクレイピングでは、maxAge のデフォルト値が 0 のため、明示的に別の maxAge を設定しない限り、チェックごとに新しいスクレイピングが実行されます。
{
"type": "scrape",
"urls": ["https://example.com/pricing"],
"scrapeOptions": {
"formats": ["markdown"],
"maxAge": 0
}
}
デフォルトでは、ページモニターはページのMarkdownの差分を比較します。価格、見出し、在庫フラグ、リスト内の項目など、特定のフィールドが変更されたときだけ通知するには、ターゲットのscrapeOptionsにchangeTrackingフォーマットを追加します。JSONモードとMixedモードについては、変更追跡を参照してください。
- スケジュール: cron または自然言語で指定する実行間隔。最短 5 分です。
- ゴールと判定: 意味のある変更があった場合にのみアラートします。
- 通知: webhook とメールで配信します。
- チェック結果: 各チェックと、そのページごとの差分を確認できます。
- 料金: チェックごとに URL あたり 1 クレジット、加えて任意の判定分がかかります。