servo-fetch は何をしますか?
自己完結型のブラウザエンジンで、WebコンテンツをMarkdown、JSON、スクリーンショットとして取得、レンダリング、抽出します — Chromium、APIキー、セットアップは不要です。
特徴
- 自己完結型: 単一のバイナリで、依存関係はありません。
- 高速: Servoブラウザエンジンを使用してWebページをレンダリングします。
- AI対応: 構造化されたMarkdown、クリーンなJSON、スクリーンショットとしてページを抽出します。
- 安全: sandbox環境で動作します。
- どこでも動作: macOS、Linux、Windowsで利用可能。
インストール
# 最新のリリースをダウンロード(推奨)
# macOS(Apple Silicon)
curl -L https://github.com/konippi/servo-fetch/releases/latest/download/servo-fetch-aarch64-apple-darwin.tar.gz | tar xz
# macOS(Intel)
curl -L https://github.com/konippi/servo-fetch/releases/latest/download/servo-fetch-x86_64-apple-darwin.tar.gz | tar xz
# Linux
curl -L https://github.com/konippi/servo-fetch/releases/latest/download/servo-fetch-x86_64-unknown-linux-gnu.tar.gz | tar xz
# Windows
# リリースページからservo-fetch-x86_64-pc-windows-msvc.zipをダウンロードして展開
または、npxを使用:
npx @konippi/servo-fetch <url>
または、Homebrewを使用:
brew tap konippi/tap
brew install servo-fetch
使い方
基本
# URLの内容を取得(デフォルト: Markdown)
servo-fetch https://example.com
# 特定の出力形式を指定
servo-fetch --format json https://example.com
servo-fetch --format screenshot https://example.com
servo-fetch --format html https://example.com
AIエージェントと一緒に使う
このツールは、Claude Code、Cline、Goose、その他のAIエージェントと一緒に使うために設計されています。エージェントは、Webページの内容をMarkdownまたはJSONとして直接読むことができます。
Claude Code:
claude code -- "Webサイトhttps://example.comの内容を要約してください。"
# Claude Codeは自動的にservo-fetchを呼び出します
コマンドラインから:
servo-fetch https://example.com
# Markdown形式の内容が出力されます
オプション
| オプション | 説明 |
|---|---|
--format | 出力形式: markdown、json、screenshot、html(デフォルト: markdown) |
--output または -o | 出力ファイル(指定しない場合は標準出力) |
--width | ビューポートの幅(デフォルト: 1920) |
--height | ビューポートの高さ(デフォルト: 1080) |
--timeout | ページ読み込みのタイムアウト秒数(デフォルト: 30) |
--help | ヘルプメッセージを表示 |
--version | バージョンを表示 |
例
特定のページをスクリーンショットとして保存:
servo-fetch --format screenshot --output screenshot.png https://example.com
JSON形式で取得:
servo-fetch --format json https://example.com
タイムアウトを長く設定:
servo-fetch --timeout 60 https://heavy-site.example.com
しくみ
servo-fetchは、Servoブラウザエンジン(Mozilla Researchが開発したモダンなブラウザエンジン)を使用して、完全なブラウザ環境でWebページをレンダリングします。これにより、JavaScriptを実行し、動的コンテンツをレンダリングし、実際のブラウザと同じようにスタイルを適用します。
ページがレンダリングされた後、servo-fetchはコンテンツを抽出し、指定された形式に変換します:
- Markdown: 読みやすさのためにクリーンアップされ、AIが消費しやすい形式
- JSON: スクリプト処理に適した構造化データ
- HTML: 完全なブラウザレンダリング後HTML
- スクリーンショット: ページのラスタライズ画像
システム要件
- OS: macOS 12+、Linux(glibc 2.28+)、Windows 10+
- アーキテクチャ: x86_64、ARM64(aarch64)
- 依存関係: なし!単一のバイナリですべてです。
ライセンス
MIT