mcpField
S
scrapfly-cli

scrapfly-cli

github.com/scrapflyデータ・データベース5213 回インストール2 週間前に更新
リポジトリ

scrapfly-cli について

scrapfly-cliは、Scrapflyのスクレイピング、スクリーンショット、抽出、クロール、ブラウザー機能を扱うコマンドラインツールです。開発者やAIエージェント向けで、パイプライン用のJSON出力と、モデルが操作を選ぶエージェントモードを備えています。

主な機能

  1. 01ページの取得とコンテンツ抽出
  2. 02スクリーンショットと再帰クロール
  3. 03単発または永続CDPブラウザーの操作
  4. 04LLMエージェントモードでのブラウザータスク
  5. 05定期ジョブとアラートの設定
  6. 06LLMパイプライン向けの構造化JSON出力

活用シーン

  1. 01コマンドラインからのページ取得と処理
  2. 02永続セッションでのブラウザー操作の自動化
  3. 03LLMエージェントによるサイト閲覧と調査
  4. 04クロールの定期実行とWebhookへの結果配信

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/scrapfly/skills --skill scrapfly-cli

インストール後、Claude Code で/scrapfly-cliを入力して読み込まれたか確認します。

詳細

翻訳後に原文が更新されています。最新の内容は原文をご確認ください。

Scrapfly:ウェブスクレイピング、レンダリング、ブラウザー自動化

Scrapfly を使うと、スクレイピング、スクリーンショット、AI 抽出、再帰クロール、CDP 経由で直接操作するリモートブラウザー、永続セッションデーモン経由で操作するリモートブラウザー、または LLM エージェントに引き渡すリモートブラウザーという 5 つの製品を通じて、AI エージェントやアプリケーションがウェブにアクセスできます。

この CLI scrapfly は、5 つの製品すべてに加え、Playwright-MCP 形式のエージェントモードも利用できる共通インターフェイスです。デフォルトで JSON を出力するため、LLM の呼び出し元はそのままパイプで渡せます。

インストール

macOS universal、Linux amd64/arm64、Windows amd64 用のビルド済みバイナリは リリースページから入手できます。または、ソースからインストールします。

go install github.com/scrapfly/scrapfly-cli/cmd/scrapfly@latest

6 つの利用方法

方法 A(コンテンツの取得): scrapfly scrape <url> がデフォルトです。SDK の ScrapeConfig のすべてのフィールドに対応しています。

  • レンダリングとナビゲーション:--render-js、--wait-for-selector、--rendering-wait、--rendering-stage、--auto-scroll、--js-file FILE、--js-scenario-file FILE
  • ボット対策:--unblocker(--asp は非推奨の別名ですが、引き続き使用できます)、--cost-budget N、--proxy-pool、--country、--geolocation
  • 形式と抽出:--format markdown|clean_html|text|raw + --format-option;--extraction-prompt、--extraction-model、--extraction-template、--extraction-template-file FILE(一時的なインラインテンプレート)
  • リクエストの形式:--method、--header k=v、--cookie n=v、--body、--body-file、--data-file FILE(JSON マップ形式の構造化ボディ)、--lang、--os、--browser-brand
  • セッションとキャッシュ:--session、--session-sticky-proxy、--cache、--cache-ttl N、--cache-clear、--retry=true|false
  • スクレイピング時のスクリーンショット:--screenshot(フルページのショートカット)、--screenshot-named name=selector(繰り返し指定可能)、--screenshot-flag FLAG
  • 可観測性:--debug、--ssl、--dns、--correlation-id、--tag、--webhook NAME、--timing
  • バッチ処理:位置引数で複数の URL を指定するか、--from-file PATH|- と --concurrency を使用します(標準出力には ndjson を出力)
  • パイプ対応:--proxified は JSON エンベロープなしで、上流の生のボディをストリーム出力します

方法 B(バイナリ/構造化出力): 特定の製品に特化したコマンドを使用します。

  • scrapfly screenshot <url> - ページまたはセレクターの JPG(デフォルト)、PNG、WebP、GIF を取得します。ScreenshotConfig の全機能に対応しています:--format、--capture、--resolution、--country、--option、--wait-for-selector、--rendering-wait、--auto-scroll、--js-file、--cache、--cache-ttl、--cache-clear、--webhook、--vision-deficiency。
  • scrapfly extract --file page.html --prompt "..." - すでに取得済みのドキュメントから AI/テンプレート抽出を実行します。ExtractionConfig の全機能に対応しています:--file または標準入力からのボディ、--content-type、--url、--charset、--prompt | --model | --template | --template-file(4 つの抽出モードから 1 つを指定)、--compression、--webhook、--request-timeout。
  • scrapfly crawl run <url> --max-pages N - ステータスポーリング、コンテンツのストリーミング、WARC/HAR アーティファクトに対応した再帰クロールを実行します。ダウンロード後は、crawl parse har-list|har-get|warc-list|warc-get でアーティファクトを直接読み取れます(別のツールは不要です)。詳しくは、以下のクローラーのセクションをご覧ください。

方法 C(インタラクティブブラウザー - 1 回限り): Playwright、Puppeteer、または browser-use に渡す CDP WebSocket URL を発行します。

# plain session
scrapfly browser --pretty

# pre-navigate through /unblock so the target's anti-bot is bypassed
scrapfly browser https://target.example.com --unblock --country us --pretty

browser --unblock と scrape --unblocker は、名前が紛らわしいものの、異なる製品です。--unblock は POST /unblock 経由で Cloud Browser セッションを開始し、--unblocker はステートレスな scrape または crawl でのボット対策バイパス機能です。

方法 D(インタラクティブブラウザー - 永続デーモン): 多数の CLI 呼び出しにわたって、1 つの CDP セッションを開いたままにします。Cookie、タブ、AXTree の参照はすべてデーモンの稼働中は維持されます。--session が必要なのは start のときだけです。以降の呼び出しでは ~/.scrapfly/sessions/.current を使って自動的に解決されます。

scrapfly browser --session demo --session-timeout 1800 start &
scrapfly browser navigate https://web-scraping.dev/login
scrapfly browser wait 'input[name=username]' --visible
scrapfly browser fill 'input[name=username]' user123
scrapfly browser fill 'input[name=password]' password
scrapfly browser click 'button[type=submit]'
scrapfly browser content --raw > page.html         # fully rendered HTML
scrapfly browser eval 'document.body.innerText'
scrapfly browser close                             # daemon + remote release

Scrapfly のカスタムブラウザーに対して実行する場合、fill/click/ wait/slide は、人間らしいタイミングを実現するため、Antibot CDP ドメインを自動的に使用します。content は Page.getRenderedContent を使用し、iframe のコンテンツをインライン化します。Scrapfly 以外のブラウザーに対しては、CLI は生の Input.* イベントにフォールバックします。

パス E(LLM エージェント): scrapfly agent "<task>" --url <target> は自律的なループを実行します。モデルがツール呼び出し(open、snapshot、click、fill、scroll、screenshot、eval、unblock、done)を選択し、CLI がブラウザーに対して実行します。その結果をモデルに返し、モデルが done を呼び出すまで繰り返します。プロバイダーは差し替え可能です:Anthropic(デフォルト)、OpenAI、Gemini、またはローカル(Ollama/OpenAI 互換)。AXTree ベースの観測により、トークン予算を小さく抑えます。

パス F(REST API のみ): CLI を使わず、?key=<API_KEY> を指定して https://api.scrapfly.io/{scrape,screenshot,extraction,crawl} を直接呼び出します。公式 SDK:Python、TypeScript、Go、Rust。docs.scrapfly.io をご覧ください。

パス G(アカウント指標のアラート): scrapfly alert ... は Scrapfly の監視指標(成功率、ブロック率、エラー数、コスト、レイテンシなど)に対するしきい値ルールを定義し、メール、Webhook、アプリ内通知を通じて通知を配信します。Enterprise プランです。

# Discover legal metrics
scrapfly alert metric-families

# Tune the threshold against the last 24h
scrapfly alert preview \
  --metric scrape.success_rate --comparator lt --threshold 95 \
  --sustained-minutes 10 --range-minutes 1440

# Create
scrapfly alert create \
  --name "Scrape Success Rate Low" \
  --metric scrape.success_rate --comparator lt --threshold 95 \
  --sustained-minutes 10 \
  --channel email:[email protected] \
  --channel webhook:https://hooks.example.com/scrapfly

alert list / get / update / snooze / unsnooze / test / delete / series / count-active で、残りのライフサイクル操作を実行できます。アラートごとの HMAC 署名キーはサーバー側で生成され、Webhook の検証に使えるよう alert get で公開されます。詳しいリファレンスは、scrapfly-alerting スキルをご覧ください。

パス H(定期ジョブのスケジュール設定): scrapfly schedule と製品ごとのサブグループ(scrapfly scrape schedule、scrapfly screenshot schedule、scrapfly crawl schedule)を使って、cron または間隔ベースで定期的に実行し、結果を Webhook に配信するジョブを定義します。

# Daily scrape schedule (config payload from a file, '-' for stdin)
scrapfly scrape schedule create --cron "0 6 * * *" \
  --webhook my-hook --config ./scrape.json

# Interval schedule with an inline payload
scrapfly crawl schedule create --interval 6 --unit hour \
  --webhook my-hook --config-inline '{"url":"https://example.com"}'

# Cross-product lifecycle (top-level group)
scrapfly schedule list [--status ACTIVE|PAUSED|CANCELLED]
scrapfly schedule get <id>
scrapfly schedule update <id> --set-recurrence --cron "0 */2 * * *"
scrapfly schedule pause <id>     # / resume <id>
scrapfly schedule execute <id>   # fire now, ignoring next_scheduled_date
scrapfly schedule delete <id>    # terminal, cannot be resumed

--webhook は必須です(各実行の結果の送信先です)。--cron は --interval/--unit より優先されます。--retry-on-failure --max-retries N(0~3)と --allow-concurrency で、実行の動作を調整できます。

パス I(BYOP Exit Peer): scrapfly exit-peer は、mTLS トンネル経由で Scrapfly のトラフィックを独自のネットワーク出口にルーティングする Bring-Your-Own-Proxy コネクターをインストールして実行します。

scrapfly exit-peer install            # download binary + per-customer cert bundle
scrapfly exit-peer run --name lab-01  # run the connector in the foreground
scrapfly exit-peer status             # local install state + cert lifetime

インストール先ディレクトリのデフォルトは $SCRAPFLY_BYOP_DIR または $HOME/.scrapfly/byop です。

認証

一度設定します:

export SCRAPFLY_API_KEY=scp-live-...
# or, persisted:
scrapfly config set-key scp-live-...
# interactive (opens a browser to mint a key):
scrapfly auth login        # / logout / whoami

解決順序:--api-key フラグ > SCRAPFLY_API_KEY 環境変数 > ~/.scrapfly/config.json。開発環境/セルフホスト環境のスタックでは、--host と --browser-host、または SCRAPFLY_API_HOST/SCRAPFLY_BROWSER_HOST を指定します。

scrapfly status は、CLI のバージョン、認証状態、アカウントの使用状況を 1 回の呼び出しで表示します。scrapfly account は、プラン、クォータ、サブスクリプションの使用状況を表示します。

agent モードの LLM プロバイダーには、それぞれ専用の環境変数を使用します: ANTHROPIC_API_KEY、OPENAI_API_KEY、GEMINI_API_KEY、または OLLAMA_HOST。 CLI は設定済みの最初の変数を自動検出します。

出力仕様(LLM 向け)

すべてのコマンドは、標準出力に安定した JSON エンベロープを出力します:

{"success": true,  "product": "scrape", "data": { ... }}
{"success": false, "product": "scrape", "error": {"code": "...", "message": "...", "http_status": 422}}

成功時の終了コードは 0、エラー時は 1 です。--pretty を指定すると、JSON の代わりに 1 行の人間向け要約を出力します。バイナリの生成物(スクリーンショット、クロールの成果物、セッション録画)は、出力先として -o <file> または -O <dir> が必要です。どちらも指定しない場合、JSON モードでは base64 が返されます。browser content --raw は、エンベロープなしで HTML 本文を標準出力に直接出力します(パイプでの利用に便利です)。

ブラウザーセッションのリファレンス

ライフサイクル
コマンド用途
browser --session <id> start [--url <target> --unblock]デーモンを起動します。フォアグラウンドで起動し、バックグラウンドにするには & を付けます
browser statuspid、ws_url、alive を表示します
browser stopデーモンのみを停止します(リモートセッションはタイムアウトまで存続します)
browser closeデーモンを停止し、Scrapfly のリモートブラウザーを直ちに解放します
アクション(デーモンに送信されます。start の実行後は --session は省略可能です)
コマンド説明
browser navigate <url>Page.navigate を実行し、読み込みを待機します
browser snapshotAXTree(ref(e1、e2、…)、ax_node_id、backend_node_id 付き)を取得します
browser click <locator>CSS/XPath/axNodeId には Antibot.clickOn を使用し、ref には直接クリックします
browser fill <locator> <value> [--clear --wpm N]CSS/XPath/axNodeId には Antibot.fill を使用し、ref には Input.insertText を使用します
browser click-ai <description>LLM で自然言語の説明から対象を特定し、クリックします
browser fill-ai <description> <value>LLM で対象を特定し、入力します
browser wait <selector> [--visible --timeout-ms N]Antibot.waitForElement(ネイティブ機能を使用。JS でのポーリングは行いません)
browser slide <source> --target <sel> | --distance <px>Antibot.clickAndSlide(スライダー形式の CAPTCHA 用)
browser scroll <direction> [--amount px --ref e3]Input のホイールイベント
browser screenshot [--fullpage]Page.captureScreenshot を使って PNG を取得します。ファイルには -o/-O を使用します
browser content [--raw] [--skip-iframes]Page.getRenderedContent - iframe をインライン化した HTML
browser eval <js>awaitPromise を指定して Runtime.evaluate を実行します
ロケーター

click / fill では次のいずれかを指定できます。

  • AXTree ref - snapshot の実行結果から取得する e3 などの値です。Input.* の直接実行経路を使用します。
  • CSS セレクター(デフォルト) - input[name=username]
  • XPath - --selector-type xpath を指定した //button[text()="Submit"]
  • AX ノード ID - snapshot の ax_node_id フィールドにある 42 などの値に、--selector-type axNodeId を指定します
  • AI による説明 - ai:<plain English>(または click-ai / fill-ai のショートカット)を指定すると、LLM がライブスナップショットから ref を特定します。

CSS/XPath/axNodeId の場合、CLI は Scrapfly のブラウザー上で Antibot を経由して実行します。

録画、拡張機能
コマンド用途
browser listアカウントで有効な Browser セッションを一覧表示します
browser video <run-id>セッションの録画(webm)をダウンロードします。-o/-O が必要です
browser playback <run-id>デバッグ実行の再生メタデータを取得します
browser extensions list | get <id> | upload <path> | delete <id>アカウントのブラウザー拡張機能(.zip/.crx)を管理します
人による引き継ぎ(VNC/WebRTC)と認証情報ボルト

これらのフラグは browser、browser start、browser execute で使用できます。

フラグ目的
--vault NAME --vault-key B64KEY認証情報ボルトを接続します。セッションが引き渡される前に、項目が復号されて CDP 経由で送信されます。キーはお客様だけが保持し、Scrapfly が保存することはありません。キーを省略すると、セッションは ERR::BROWSER::VAULT_KEY_INVALID で失敗します
--enable-vnc --vnc-password PW人が引き継げるよう、セッションを VNC 経由で公開します
--enable-rtc --rtc-password PW [--rtc-username U]セッションを WebRTC ライブ動画経由で公開します(ユーザー名の既定値は scrapfly です)
--hitl-allowed-network IP|CIDR認証情報なしで接続できる送信元範囲を信頼します(複数回指定可能)。これはパスワード要件を置き換えるものであり、パスワード要件に追加するものではありません。その後、サーバーが独自のシークレットを生成します
browser saltプロジェクトのソルト sha256(api_key)[:8] を表示します

ビューアーが入力する VNC パスワードは、エンドポイントによって異なります。 Scrapfly は割り当て時に プロジェクトのソルトを付加し、2 つのエンドポイントで異なる方法で検証します。

エンドポイント入力するパスワード
TCP マルチプレクサー上のネイティブクライアント、vnc://<run_id>@<host>:5901<project_salt>-<vnc_password>
WebSocket、wss://<host>/run/<run_id>/vnc生の <vnc_password>

マルチプレクサーはソルト付きの形式で DES チャレンジを照合します(ネイティブクライアントは ソルトを除去しません)。そのため、同じパスワードを選んだ顧客同士が競合することはありません。 WebSocket ハンドラーはサーバー側でソルトを除去してから、同じ照合を行います。browser start は TCP URL と、それに対応するソルト付きパスワードを表示します。

scrapfly browser --session demo --enable-vnc --vnc-password hunter2 start &
# [session demo] vnc vnc://01K5Z.../@browser.scrapfly.io:5901
# [session demo] vnc password <project_salt>-hunter2

vnc:// のユーザー名は実行 ID です。実行 ID はセッションの割り当て後にのみ存在するため、 browser start は接続後に URL を表示します。ws モード(scrapfly browser --enable-vnc --vnc-password PW)では、JSON エンベロープに project_salt、vnc_password(ソルト付き)、および {run_id} プレースホルダーを含む vnc_url が格納されます。

クローラーリファレンス

送信とポーリング
コマンド目的
crawl start <url>クロールを送信し、UUID をすぐに表示します
crawl run <url>クロールを送信し、DONE/FAILED/CANCELLED になるまでポーリングします
crawl watch <uuid>終端状態になるまでライブ統計パネル(訪問済み/抽出済み/失敗/スキップ/キュー/クレジット)を表示します
crawl status <uuid>ステータスを取得します。エンベロープには、シェルスクリプトで使用できるトップレベルの terminal フィールド(running|done|failed|cancelled)が含まれます
crawl urls <uuid> --status visited|pending|failed|skipped検出された URL をストリーミングします(ページネーションあり)
crawl contents <uuid> --format markdown [--url URL --plain]一括 JSON、または単一 URL のプレーン本文を取得します
crawl contents-batch <uuid> <url...> [--from-file F] --format markdown最大 100 件の URL を 1 回の往復で取得します
crawl cancel <uuid>実行中のクロールを停止します
crawl artifact <uuid> --type warc|har -o file記録をダウンロードします
crawl start / crawl run のフラグ

ドキュメントに記載されているすべての CrawlerConfig フィールドが公開されています。

フラグ対応先
--max-pages Npage_limit
--max-depth Nmax_depth
--max-duration Nmax_duration(秒、15~10800)
--max-api-credit Nmax_api_credit
--exclude PATH / --include PATHexclude_paths / include_only_paths(繰り返し指定可能、相互排他)
--ignore-base-pathignore_base_path_restriction
--follow-external / --allowed-external-domain Dfollow_external_links / allowed_external_domains
--follow-internal-subdomains true|false(三値) / --allowed-internal-subdomain D対応するフィールド
--header k=v(繰り返し指定可能)headers
--delay MS / --user-agent UA / --max-concurrency N / --rendering-delay MSリクエストの設定
--use-sitemaps / --ignore-no-follow / --respect-robots-txt true|false戦略
--cache / --cache-ttl S / --cache-clearキャッシュ
--content-format F(繰り返し指定可能) / --extraction-rules-file PATHコンテンツおよび抽出
--unblocker / --proxy-pool P / --country CCスクレイピングのオプション
--webhook NAME / --webhook-event E(繰り返し指定可能)Webhook
WARC / HAR アーティファクトから読み込む
scrapfly crawl artifact <uuid> --type warc -o crawl.warc
scrapfly crawl parse warc-list crawl.warc --pretty             # URLs + statuses
scrapfly crawl parse warc-get crawl.warc https://example.com \
  --raw > page.html                                             # body straight to stdout

scrapfly crawl artifact <uuid> --type har -o crawl.har
scrapfly crawl parse har-list crawl.har --pretty               # request table
scrapfly crawl parse har-get crawl.har https://example.com/api \
  --raw | jq .                                                  # extract one response

ファイルパスに - を指定すると標準入力から読み込むため、crawl artifact -o - の出力をそのままパイプで渡せます。

コア API エンドポイント

製品エンドポイントCLI
Web スクレイピングGET/POST /scrapescrapfly scrape <url>
スクリーンショットPOST /screenshotscrapfly screenshot <url>
抽出POST /extractionscrapfly extract
クローラーPOST /crawl + /crawl/{uuid}/{status,urls,contents,artifact}scrapfly crawl {start,run,status,urls,contents,cancel,artifact}
ブラウザー(CDP)wss://browser.scrapfly.io?api_key=...scrapfly browser
ブラウザーのブロック解除POST /unblockscrapfly browser <url> --unblock
ブラウザーセッションの停止POST /session/{id}/stopscrapfly browser close
セッション録画GET /run/{id}/videoscrapfly browser video <run-id>
フィードバックPOST /dashboard/api/feedback(API ホストではなく、scrapfly.io 上)scrapfly feedback

簡単な使用例

# Scrape a JS-heavy page with the unblocker and markdown output
scrapfly scrape https://web-scraping.dev/products --render-js --unblocker --format markdown

# Scrape many URLs in parallel (ndjson on stdout, one envelope per line)
scrapfly scrape https://web-scraping.dev/products \
               https://web-scraping.dev/product/1 \
               https://web-scraping.dev/product/2 \
               --format markdown --concurrency 5

# Or feed URLs from a file
scrapfly scrape --from-file urls.txt --format markdown | jq -c '.data.result.url'

# Pipe scrape body straight into AI extraction
scrapfly scrape https://web-scraping.dev/product/1 --render-js --proxified \
  | scrapfly extract --content-type text/html --prompt "name, price, sku"

# Screenshot into an auto-named file in a directory
scrapfly -O ./shots screenshot https://example.com --resolution 1920x1080

# Crawl synchronously with markdown content streaming
scrapfly crawl run https://example.com --max-pages 20 --content-format markdown

# Multi-call browser session: log in, dump rendered HTML, clean up
scrapfly browser --session demo --session-timeout 1800 start &
scrapfly browser navigate https://web-scraping.dev/login
scrapfly browser wait 'input[name=username]' --visible
scrapfly browser fill 'input[name=username]' user123 --wpm 280
scrapfly browser fill 'input[name=password]' password
scrapfly browser click 'button[type=submit]'
scrapfly browser content --raw > after-login.html
scrapfly browser close

# Hand a Scrapfly-unblocked CDP URL to browser-use
WS=$(scrapfly browser https://target.example.com --unblock --country us --pretty | jq -r .ws_url)
python examples/browser-use-with-scrapfly.py   # reads WS from scrapfly CLI

# LLM agent with structured output
ANTHROPIC_API_KEY=... scrapfly agent "Name and price of the first product" \
  --url https://web-scraping.dev/products \
  --schema '{"type":"object","properties":{"name":{"type":"string"},"price":{"type":"string"}},"required":["name","price"]}'

製品へのフィードバックの報告

scrapfly feedback を使うと、ターミナルから Scrapfly の各機能(CLI、API、ドキュメント、ダッシュボード、MCP サーバー、スキル)について報告できます。報告はダッシュボードのフィードバックウィジェットと同じストアに保存され、チームが確認します。これはサポート窓口ではありません。チケットは作成されず、返信もありません。そのため、アカウントや連携に関する問題は引き続き https://scrapfly.io/dashboard/support にお問い合わせください。

scrapfly feedback --sentiment negative --feature crawler_api \
  --message "crawl status returned 200 with an empty urls array for ten minutes after the crawl finished" \
  --context "Mirroring a 300-page docs site, polling crawl status every 15s, CLI 0.4.1"

この CLI を操作するエージェントの場合:セッション中に Scrapfly の機能が役立った、わかりにくかった、間違っていた、または不完全だった場合は、ユーザーのタスクが完了したセッションの最後に、報告を 1 件だけ作成してください。下書きをユーザーに見せ、同意を得た場合にのみ送信してください。報告はユーザーの API キーを使って送信され、ユーザーのアカウントに関連付けられます。

  • --sentiment negative は、不具合やブロッカーによってコマンドが動作しなかった場合に指定します。neutral は、多少の不便や回避策はあったものの、タスクを完了できた場合に指定します。positive は、正常に動作した場合や、ある手順が期待以上にうまくいった場合に指定します。肯定的な報告も送信してください。
  • --message にはコマンド名とその動作を、--context には目的と CLI のバージョンを記載します。どちらも 10~2000 文字で、--message は 5 語以上必要です。「it broke」だけでは、対応可能な報告になりません。
  • --feature では、報告の対象となる製品領域を指定します。無効な値を指定すると選択肢の一覧全体が表示されるため、エラーメッセージを見て修正できます。
  • コーディングエージェントの環境変数が存在する場合、--actor のデフォルトは agent、それ以外の場合は human です。ユーザー自身の言葉を伝える場合は --actor human を指定し、ユーザーの表現をそのまま使ってください。
  • 報告するのは製品についてです。自分の環境、モデルの動作、わかりにくいと感じたプロンプト、次の呼び出しで回避できたツールエラーについては報告しないでください。
  • 送信に失敗しても、その原因となったタスクを失敗させたり、中断したり、再試行したりしてはいけません。429 の場合は、アカウントの 1 時間あたりの送信上限に達しています。報告を破棄してください。それ以外のエラーの場合は、下書きの --message と --context を表示し、ユーザーが手動で報告できるようにしてください。

シェル補完

Cobra は bash、zsh、fish、PowerShell 用の補完スクリプトを提供しています。一度だけインストールしてください。

# zsh
scrapfly completion zsh > "${fpath[1]}/_scrapfly"
# bash
scrapfly completion bash > /etc/bash_completion.d/scrapfly  # or ~/.bash_completion.d/
# fish
scrapfly completion fish > ~/.config/fish/completions/scrapfly.fish

MCP サーバー

scrapfly mcp serve は、stdio 経由で scrape、screenshot、extract、crawl_run、selector を MCP ツールとして公開します。バイナリを対応クライアント(Claude Desktop、Cursor、Claude Code)に追加してください。

{
  "mcpServers": {
    "scrapfly": {
      "command": "scrapfly",
      "args": ["mcp", "serve"],
      "env": { "SCRAPFLY_API_KEY": "scp-live-..." }
    }
  }
}

エージェントのループ内から find_selector ツールを使ってセレクターを検出することもできます。スナップショットごとの ref に頼らず、モデルが長期的に使える CSS セレクターを生成したい場合に便利です。

参考資料

コメント