
AI ベースの Python スクレイパー
## 🚀 **さらに高速でシンプルな大規模スクレイピング方法(わずか5行のコード)をお探しですか?** [**ScrapeGraphAI.com**](https://scrapegraphai.com/?utm_source=github&utm_medium=readme&utm_campaign=oss_cta&ut#m_content=top_banner) で拡張版をチェックしてください! 🚀
---
# 🕷️ ScrapeGraphAI: スクレイプは一度だけ
<p align="center">
<a href="https://scrapegraphai.com">
<img src="https://assets.kitploit.com/production/public/readmes/41478/e11a555115b80e07241afdb0aec04ee9fae66f983d969d27fbd8a64a21f090de.png" alt="ScrapeGraphAI" style="width: 100%;">
</a>
</p>
[English](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/README.md) | [中文](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/chinese.md) | [日本語](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/japanese.md)
| [한국어](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/korean.md)
| [Русский](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/russian.md) | [Türkçe](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/turkish.md)
| [Deutsch](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/german.md)
| [Español](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/spanish.md)
| [français](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/french.md)
| [Português](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/portuguese.md)
| [Italiano](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/italian.md)
[](https://pepy.tech/projects/scrapegraphai)
[](https://opensource.org/licenses/MIT)
[](https://discord.gg/gkxQDAjfeX)
<p align="center">
<a href="https://trendshift.io/repositories/15078" target="_blank"><img src="https://trendshift.io/api/badge/repositories/15078" alt="ScrapeGraphAI%2FScrapegraph-ai | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
<p align="center">
[ScrapeGraphAI](https://scrapegraphai.com) は、LLMとダイレクトグラフロジックを使用して、ウェブサイトやローカルドキュメント(XML、HTML、JSON、Markdownなど)向けのスクレイピングパイプラインを作成する *ウェブスクレイピング* Pythonライブラリです。
抽出したい情報を指定するだけで、ライブラリが処理を実行してくれます!
## 🚀 統合機能
ScrapeGraphAIは、人気のフレームワークやツールとのシームレスな統合を提供し、スクレイピング機能を強化します。PythonやNode.jsでの開発、LLMフレームワークの利用、ノーコードプラットフォームでの作業など、あらゆるニーズに対応する包括的な統合オプションを提供しています。
<p align="center">
<a href="https://scrapegraphai.com">
<img src="https://assets.kitploit.com/production/public/readmes/41478/0e788431fde2dc01cf2aa4b53d87b9befe3c728b719a5a45dec11ffb4d7c77a5.png" alt="大規模なWebデータ抽出をお探しですか?ScrapeGraphAIクラウドをお試しください" style="width: 100%;">
</a>
</p>
詳細については、次の[リンク](https://scrapegraphai.com)をご覧ください。
**統合機能**:
- **API**: [ドキュメント](https://docs.scrapegraphai.com/introduction)
- **SDK**: [Python](https://docs.scrapegraphai.com/sdks/python), [Node](https://docs.scrapegraphai.com/sdks/javascript)
- **LLMフレームワーク**: [Langchain](https://docs.scrapegraphai.com/integrations/langchain), [Llama Index](https://docs.scrapegraphai.com/integrations/llamaindex), [Crew.ai](https://docs.scrapegraphai.com/integrations/crewai), [Agno](https://docs.scrapegraphai.com/integrations/agno), [CamelAI](https://github.com/camel-ai/camel)
- **ローコードフレームワーク**: [Pipedream](https://pipedream.com/apps/scrapegraphai), [Bubble](https://bubble.io/plugin/scrapegraphai-1745408893195x213542371433906180), [Zapier](https://zapier.com/apps/scrapegraphai/integrations), [n8n](http://localhost:5001/dashboard), [Dify](https://dify.ai), [Toolhouse](https://app.toolhouse.ai/mcp-servers/scrapegraph_smartscraper)
- **MCPサーバー**: [リンク](https://smithery.ai/server/@ScrapeGraphAI/scrapegraph-mcp)
## 🚀 クイックインストール
Scrapegraph-aiのリファレンスページは、PyPIの公式ページで公開されています: [pypi](https://pypi.org/project/scrapegraphai/)。
```bash
pip install scrapegraphai
# IMPORTANT (for fetching websites content)
playwright install
```
**注記**: 他のライブラリとの競合を避けるために、仮想環境にライブラリをインストールすることをお勧めします 🐱
## 💻 使用方法
ウェブサイト(またはローカルファイル)から情報を抽出するために使用できる、複数の標準スクレイピングパイプラインがあります。
最も一般的なのは `SmartScraperGraph` で、ユーザープロンプトとソースURLを指定すると、単一のページから情報を抽出します。
```python
from scrapegraphai.graphs import SmartScraperGraph
# Define the configuration for the scraping pipeline
graph_config = {
"llm": {
"model": "ollama/llama3.2",
"model_tokens": 8192,
"format": "json",
},
"verbose": True,
"headless": False,
}
# Create the SmartScraperGraph instance
smart_scraper_graph = SmartScraperGraph(
prompt="Extract useful information from the webpage, including a description of what the company does, founders and social media links",
source="https://scrapegraphai.com/",
config=graph_config
)
# Run the pipeline
result = smart_scraper_graph.run()
import json
print(json.dumps(result, indent=4))
```
> [!NOTE]
> OpenAIやその他のモデルを使用する場合は、llm設定を変更するだけです!
> ```python
>graph_config = {
> "llm": {
> "api_key": "YOUR_OPENAI_API_KEY",
> "model": "openai/gpt-4o-mini",
> },
> "verbose": True,
> "headless": False,
>}
>```
出力は次のような辞書になります:
```python
{
"description": "ScrapeGraphAI transforms websites into clean, organized data for AI agents and data analytics. It offers an AI-powered API for effortless and cost-effective data extraction.",
"founders": [
{
"name": "",
"role": "Founder & Technical Lead",
"linkedin": "https://www.linkedin.com/in/perinim/"
},
{
"name": "Marco Vinciguerra",
"role": "Founder & Software Engineer",
"linkedin": "https://www.linkedin.com/in/marco-vinciguerra-7ba365242/"
},
{
"name": "Lorenzo Padoan",
"role": "Founder & Product Engineer",
"linkedin": "https://www.linkedin.com/in/lorenzo-padoan-4521a2154/"
}
],
"social_media_links": {
"linkedin": "https://www.linkedin.com/company/101881123",
"twitter": "https://x.com/scrapegraphai",
"github": "https://github.com/ScrapeGraphAI/Scrapegraph-ai"
}
}
```
複数のページから情報を抽出したり、Pythonスクリプトを生成したり、オーディオファイルを生成したりできる、他のパイプラインもあります。
| パイプライン名 | 説明 |
|-------------------------|------------------------------------------------------------------------------------------------------------------|
| SmartScraperGraph | ユーザープロンプトと入力ソースのみを必要とするシングルページスクレイパー。 |
| SearchGraph | 検索エンジンの上位n件の検索結果から情報を抽出するマルチページスクレイパー。 |
| SpeechGraph | ウェブサイトから情報を抽出し、オーディオファイルを生成するシングルページスクレイパー。 |
| ScriptCreatorGraph | ウェブサイトから情報を抽出し、Pythonスクリプトを生成するシングルページスクレイパー。 |
| SmartScraperMultiGraph | 単一のプロンプトとソースのリストを指定して、複数のページから情報を抽出するマルチページスクレイパー。 |
| ScriptCreatorMultiGraph | 複数のページとソースから情報を抽出するためのPythonスクリプトを生成するマルチページスクレイパー。 |
これらの各グラフにはマルチバージョンがあります。LLMへの呼び出しを並列で実行できます。
**OpenAI**、**Groq**、**Azure**、**Gemini**、**[MiniMax](https://github.com/scrapegraphai/scrapegraph-ai/blob/main/docs/minimax.md)** などのAPIを通じてさまざまなLLMを使用したり、**Ollama** を使用してローカルモデルを使用したりすることができます。
ローカルモデルを使用する場合は、[Ollama](https://ollama.com/) をインストールし、**ollama pull** コマンドでモデルをダウンロードすることを忘れないでください。
## 📖 ドキュメント
[](https://colab.research.google.com/drive/1sEZBonBMGP44CtO6GQTwAlL0BGJXjtfd?usp=sharing)
ScrapeGraphAIのドキュメントは[こちら](https://docs.scrapegraphai.com/introduction)にあります。
## 🆚 オープンソース vs マネージドAPI
ScrapeGraphAIには、自分で実行する**オープンソースライブラリ**と、**マネージドクラウドAPI**([Python](https://github.com/ScrapeGraphAI/scrapegraph-py) および [JS/TS](https://github.com/ScrapeGraphAI/scrapegraph-js) SDK経由で使用)の2つのバージョンがあります。この表は違いを説明しているので、適切な方を選択できます。
| | オープンソース(`scrapegraphai`) | マネージドAPI(`scrapegraph-py` / `scrapegraph-js`) |
|---|---|---|
| **概要** | 自分で実行するPythonライブラリ | SDK経由で呼び出すホスト型クラウドサービス |
| **実行環境** | 自社インフラ(セルフホスト) | ScrapeGraphAIクラウド |
| **LLM** | 自分で用意(OpenAI、Groq、Gemini、Azure、Ollama経由のローカル) | 管理不要 |
| **ブラウザ / JSレンダリング** | 自分で設定(Playwright) | 管理済み(ステルス、`auto`/`fast`/`js` モード) |
| **プロキシ & アンチボット** | 自己責任 | 含まれています |
| **スケーリング & メンテナンス** | 自己責任 | 完全管理 |
| **コストモデル** | LLMトークン + 自社インフラ | 従量課金クレジット |
| **認証** | 独自のLLMキー | `SGAI_API_KEY` |
| **機能** | グラフパイプライン(SmartScraper、Search、Speech、ScriptCreator…) | Scrape、Extract、Search、Crawl、Monitor、History |
| **セットアップの手間** | 設定が多い | 最小限 — APIキー + 1回の呼び出し |
| **ライセンス** | MIT | SDKはMIT、APIサービスは有料 |
完全な制御、オンプレミス/セルフホストのデータ、ローカルLLM(Ollama)、または細かいコスト調整を希望し、ブラウザ、プロキシ、スケーリングを自分で管理しても構わない場合は、**オープンソースライブラリ**を選択してください。
インフラゼロ、管理されたJSレンダリング&アンチボット、組み込みの**Crawl** とスケジュールされた**Monitor** ジョブ、そして本番環境への最短ルートを希望する場合は、**マネージドAPI** を選択してください — クレジット単位の課金です。
- オープンソースライブラリ: https://github.com/ScrapeGraphAI/Scrapegraph-ai
- Python SDK: https://github.com/ScrapeGraphAI/scrapegraph-py
- JS/TS SDK: https://github.com/ScrapeGraphAI/scrapegraph-js
- APIドキュメント: https://docs.scrapegraphai.com/introduction
## 🤝 コントリビューション
ぜひコントリビュートして、改善点について話し合い、提案を共有するためにDiscordサーバーに参加してください!
[コントリビューションガイドライン](https://github.com/ScrapeGraphAI/Scrapegraph-ai/blob/main/CONTRIBUTING.md)をご覧ください。
[](https://discord.gg/uJN7TYcpNa)
[](https://www.linkedin.com/company/scrapegraphai/)
[](https://twitter.com/scrapegraphai)
## 🔗 ScrapeGraph API & SDKs
ScrapeGraphをシステムに統合するための迅速なソリューションをお探しの場合は、[こちら](https://scrapegraphai.com)で当社の高性能APIをチェックしてください!
[](https://scrapegraphai.com)
PythonとNode.jsの両方でSDKを提供しており、プロジェクトへの統合が簡単です。以下で確認できます:
| SDK | 言語 | GitHubリンク |
|-----------|----------|-----------------------------------------------------------------------------|
| Python SDK | Python | [scrapegraph-py](https://docs.scrapegraphai.com/sdks/python) |
| Node.js SDK | Node.js | [scrapegraph-js](https://docs.scrapegraphai.com/sdks/javascript) |
公式APIドキュメントは[こちら](https://docs.scrapegraphai.com/introduction)にあります。
## 📈 テレメトリー
パッケージの品質とユーザーエクスペリエンスを向上させるため、匿名の使用状況メトリクスを収集しています。このデータは、改善の優先順位付けと互換性の確保に役立ちます。オプトアウトを希望する場合は、環境変数 SCRAPEGRAPHAI_TELEMETRY_ENABLED=false を設定してください。詳細については、[こちら](https://docs.scrapegraphai.com/introduction)のドキュメントを参照してください。
## ❤️ コントリビューター
[](https://github.com/ScrapeGraphAI/Scrapegraph-ai/graphs/contributors)
## 🎓 引用
研究目的で当ライブラリを使用された場合は、以下の参考文献として引用してください:
```text
@misc{scrapegraph-ai,
author = {Lorenzo Padoan, Marco Vinciguerra},
title = {Scrapegraph-ai},
year = {2024},
url = {https://github.com/ScrapeGraphAI/Scrapegraph-ai},
note = {A Python library for scraping leveraging large language models}
}
```
## 著作者
| | 連絡先情報 |
|--------------------|----------------------|
| Marco Vinciguerra | [](https://www.linkedin.com/in/marco-vinciguerra-7ba365242/) |
| Lorenzo Padoan | [](https://www.linkedin.com/in/lorenzo-padoan-4521a2154/) |
## 📜 ライセンス
ScrapeGraphAIはMITライセンスの下でライセンスされています。詳細については、[LICENSE](https://github.com/ScrapeGraphAI/Scrapegraph-ai/blob/main/LICENSE)ファイルを参照してください。
## 謝辞
- プロジェクトへのすべてのコントリビューターと、支援してくださったオープンソースコミュニティに感謝いたします。
- ScrapeGraphAIは、データ探索および研究目的専用に作られています。ライブラリの誤用については一切責任を負いません。
❤️を込めて [ScrapeGraph AI](https://scrapegraphai.com) が作成
[Scarf tracking](https://static.scarf.sh/a.png?x-pxid=102d4b8c-cd6a-4b9e-9a16-d6d141b9212d)