REPO STORY / リポジトリ紹介
oxylabs/oxylabs-ai-studio-py
AIを活用したウェブスクレイピング・クローリング・検索APIのPython SDK
01 / 何ができる?
どんな作業に
役立つ?
OxyLabsのAI Studio APIをPythonから簡単に使えるSDKです。AIが自然言語の指示を理解して、ウェブサイトから必要なデータを自動で抽出します。複雑なスクレイピングロジックを書く代わりに、「このページから価格情報を抽出して」のような日本語のプロンプトを送るだけで、AIが適切な形式でデータを返してくれます。ウェブクローリング、単一ページのスクレイピング、ブラウザ操作、検索、サイトマップなど複数の機能を統合した総合ツールです。
- 自然言語プロンプトに基づいた柔軟なデータ抽出
- JSONスキーマの自動生成機能
- ブラウザ操作・JavaScriptレンダリング・地理情報指定に対応
Crawl・Scrape・Browser Agent・Search・Mapの5つのAPIを統合管理でき、複数形式のクレジット制限・ジオロケーション制御を細かく設定できる統合SDK です。
02 / 自分に合う?
使いどころと、
選ぶ前の確認。
こんなときに
- 自然言語プロンプトでウェブサイトから構造化データを抽出する場合
- 複数ページにまたがるコンテンツを効率的にクロールして特定情報を抽出する場合
- 検索バーやログインなどのブラウザ操作を伴う複雑なデータ取得タスクを自動化する場合
先に確認すること
以下の前提条件を確認し、必要に応じて環境を準備してください。
- Python 3.10以上
- OxyLabs AI Studio APIのAPI Key
ギット飯の日本語要約から、利用例と前提条件を紹介しています。
03 / 始め方
最初の一歩を、
順番に。
準備するもの
- Python 3.10以上
- OxyLabs AI Studio APIのAPI Key
- 依存ライブラリをインストールします。
pip install oxylabs-ai-studio
- API Keyを準備してから、AiCrawlerを使ってウェブサイトをクロールします。
from oxylabs_ai_studio.apps.ai_crawler import AiCrawler
crawler = AiCrawler(api_key="<API_KEY>")
result = crawler.crawl(
url="https://oxylabs.io",
user_prompt="Find all pages with proxy products pricing",
output_format="markdown",
render_javascript=False,
return_sources_limit=3,
geo_location="United States",
)
print("Results:")
for item in result.data:
print(item, "\n")
- 単一ページをスクレイピングする場合、AiScraperでスキーマを生成してから実行します。
from oxylabs_ai_studio.apps.ai_scraper import AiScraper
scraper = AiScraper(api_key="<API_KEY>")
schema = scraper.generate_schema(prompt="want to parse developer, platform, type, price game title, genre (array) and description")
result = scraper.scrape(
url="https://sandbox.oxylabs.io/products/3",
output_format="json",
schema=schema,
render_javascript=False,
optimize_content=True,
)
print(result)
- ブラウザ操作を伴う複雑なタスクはBrowserAgentで実行します。
from oxylabs_ai_studio.apps.browser_agent import BrowserAgent
browser_agent = BrowserAgent(api_key="<API_KEY>")
schema = browser_agent.generate_schema(prompt="game name, platform, review stars and price")
result = browser_agent.run(
url="https://sandbox.oxylabs.io/",
user_prompt="Find if there is game 'super mario odyssey' in the store. If there is, find the price. Use search bar to find the game.",
output_format="json",
schema=schema,
)
print(result.data)
コマンドは要約からの引用です。実行やインストールの成否は検証していません。公式の所要時間は記載されていません。
04 / 関連リポジトリ
どんなリポジトリとつながる?
比較グラフのスナップショットから関係の種類と根拠を紹介します。現在公開中のリポジトリだけを表示します。
ScrapeGraphAI/Scrapegraph-ai ↗
共通するGitHubトピック:ai-crawler,ai-scraping,ai-search,firecrawl-alternative
repos.topicsの共通項(ai-crawler,ai-scraping,ai-search,firecrawl-alternative)
グラフの元データ ↗fastcrw/crw ↗
共通するGitHubトピック:firecrawl-alternative,tavily-alternative,web-search-api
repos.topicsの共通項(firecrawl-alternative,tavily-alternative,web-search-api)
グラフの元データ ↗firecrawl/firecrawl ↗
共通するGitHubトピック:ai-scraping,ai-crawler,ai-search
repos.topicsの共通項(ai-scraping,ai-crawler,ai-search)
グラフの元データ ↗oxylabs/ai-crawler-py ↗
共通するGitHubトピック:ai-crawler,ai-scraping
repos.topicsの共通項(ai-crawler,ai-scraping)
グラフの元データ ↗