Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
"edge/en/tools/web-scraping/firecrawlscrapewebsitetool",
"edge/en/tools/web-scraping/oxylabsscraperstool",
"edge/en/tools/web-scraping/brightdata-tools",
"edge/en/tools/web-scraping/mrscraper-tools",
"edge/en/tools/web-scraping/youai-contents"
]
},
Expand Down Expand Up @@ -13903,7 +13904,8 @@
"edge/pt-BR/tools/web-scraping/stagehandtool",
"edge/pt-BR/tools/web-scraping/firecrawlcrawlwebsitetool",
"edge/pt-BR/tools/web-scraping/firecrawlscrapewebsitetool",
"edge/pt-BR/tools/web-scraping/oxylabsscraperstool"
"edge/pt-BR/tools/web-scraping/oxylabsscraperstool",
"edge/pt-BR/tools/web-scraping/mrscraper-tools"
]
},
{
Expand Down Expand Up @@ -26621,7 +26623,8 @@
"edge/ko/tools/web-scraping/firecrawlcrawlwebsitetool",
"edge/ko/tools/web-scraping/firecrawlscrapewebsitetool",
"edge/ko/tools/web-scraping/oxylabsscraperstool",
"edge/ko/tools/web-scraping/brightdata-tools"
"edge/ko/tools/web-scraping/brightdata-tools",
"edge/ko/tools/web-scraping/mrscraper-tools"
]
},
{
Expand Down Expand Up @@ -39768,7 +39771,8 @@
"edge/ar/tools/web-scraping/firecrawlcrawlwebsitetool",
"edge/ar/tools/web-scraping/firecrawlscrapewebsitetool",
"edge/ar/tools/web-scraping/oxylabsscraperstool",
"edge/ar/tools/web-scraping/brightdata-tools"
"edge/ar/tools/web-scraping/brightdata-tools",
"edge/ar/tools/web-scraping/mrscraper-tools"
]
},
{
Expand Down
128 changes: 128 additions & 0 deletions docs/edge/ar/tools/web-scraping/mrscraper-tools.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
title: أدوات MrScraper
description: استخدم MrScraper مع CrewAI لاستخراج بيانات المواقع والزحف إليها بموثوقية، وجمع بيانات الويب العامة وتحويلها إلى مخرجات منظمة ونظيفة لمسارات عمل AI.
icon: spider
mode: "wide"
---

# أدوات MrScraper

يوفر [MrScraper](https://mrscraper.com) استكشاف الويب والاستخراج باستخدام AI وجلب الصفحات المعروضة ومسارات عمل scraper القابلة لإعادة الاستخدام. يتضمن تكامل CrewAI خمس عشرة أداة مستقلة وfactory لاختيار الإمكانات التي يحتاجها Agent فقط.

## التثبيت

ثبّت `crewai-tools`. يستخدم التكامل تبعيات HTTP الموجودة، لذلك لا يلزم تثبيت SDK منفصل لـ MrScraper.

```shell
uv add crewai-tools
```

عيّن رمز API الخاص بـ MrScraper كمتغير بيئة:

```shell
export MRSCRAPER_API_TOKEN="your-mrscraper-token"
```

احتفظ بالرمز في متغير بيئة أو مدير أسرار. لا تضعه في prompts أو أوصاف Task أو ملفات المصدر أو وسيطات الأدوات التي يمكن للنموذج رؤيتها.

## البدء السريع

تعيد factory الخاصة بـ toolkit جميع الأدوات الخمس عشرة افتراضيًا. يُفضّل اختيار أصغر مجموعة مناسبة حتى يمتلك Agent مجموعة أدوات مركزة.

```python
from crewai import Agent, Crew, Task
from crewai_tools import create_mrscraper_toolkit

researcher = Agent(
role="Web researcher",
goal="Find public product pages and extract structured product data",
backstory="You make focused, cost-aware web extraction calls.",
tools=create_mrscraper_toolkit(groups=["Discovery", "Extraction"]),
)

task = Task(
description="Find the relevant product page and extract its name and price.",
expected_output="A concise summary containing the source URL, product name, and price.",
agent=researcher,
)

result = Crew(agents=[researcher], tasks=[task]).kickoff()
```

## الأدوات المتاحة

| المجموعة | الأداة | الاستخدام | المدخلات الرئيسية |
| --- | --- | --- | --- |
| Account | `MrScraperGetAccountInfoTool` | فحص تفاصيل الحساب وحدود الاستخدام | لا يوجد |
| Discovery | `MrScraperCrawlWebsiteUrlsTool` | اكتشاف عناوين URL بدءًا من موقع | `url`, `max_depth`, `max_pages`, `limit` |
| Discovery | `MrScraperSearchGoogleSerpTool` | تنفيذ بحث Google SERP متزامن | `query`, `region`, `language`, `page` |
| Extraction | `MrScraperExtractPageByPromptTool` | استخراج البيانات من صفحة واحدة باستخدام تعليمات AI | `url`, `prompt`, `output_schema`, `mode` |
| Extraction | `MrScraperExtractListingsTool` | استخراج قوائم متكررة أو مقسمة إلى صفحات | `url`, `prompt`, `output_schema`, `max_pages` |
| Extraction | `MrScraperExtractStructuredDataTool` | استخراج preset مدعوم للبيانات المنظمة | `url`, `category`, `mode` |
| Extraction | `MrScraperFetchRenderedHtmlTool` | جلب HTML معروض باستخدام JavaScript أو Markdown أو cookies أو screenshots | `url`, `html`, `markdown`, `screenshot` |
| Results | `MrScraperGetResultsTool` | عرض نتائج scraper مقسمة إلى صفحات | `scraper_id`, `page`, `page_size` |
| Results | `MrScraperGetLatestResultsTool` | استرجاع أحدث نتائج scraper | `scraper_id`, `count` |
| Results | `MrScraperGetResultDetailTool` | استرجاع نتيجة واحدة باستخدام المعرّف | `result_id` |
| Scraper Creation | `MrScraperCreatePromptScraperTool` | إنشاء scraper قابل لإعادة الاستخدام يعتمد على prompt | `url`, `prompt`, `output_schema`, `mode` |
| Scraper Creation | `MrScraperCreateListingScraperTool` | إنشاء listing scraper قابل لإعادة الاستخدام | `url`, `prompt`, `output_schema`, `max_pages` |
| Scraper Creation | `MrScraperCreateWebsiteCrawlScraperTool` | إنشاء website crawl scraper قابل لإعادة الاستخدام | `url`, `max_depth`, `max_pages`, `limit` |
| Scraper Runs | `MrScraperRunExistingScraperTool` | تشغيل AI scraper أو manual scraper حالي لعنوان URL واحد | `scraper_type`, `scraper_id`, `url` |
| Scraper Runs | `MrScraperRunExistingScraperBatchTool` | تشغيل scraper حالي لعدة عناوين URL | `scraper_type`, `scraper_id`, `urls` |

فئات البيانات المنظمة المدعومة هي `article` و`forumThread` و`hotel` و`jobPosting` و`post` و`product` و`property` و`restaurant` و`socialMediaProfile` و`tourAttraction`.

## استخدام أداة واحدة مباشرة

استخدم أداة واحدة عندما يحتاج Agent أو التطبيق إلى إمكانية واحدة فقط:

```python
from crewai_tools import MrScraperExtractPageByPromptTool

tool = MrScraperExtractPageByPromptTool()
result = tool.run(
url="https://example.com/products/123",
prompt="Extract the product name and current price",
output_schema={"name": "string", "price": "number"},
)
```

يمكنك أيضًا تمرير `api_token="..."` إلى constructor الأداة أو factory الخاصة بـ toolkit. يُوصى باستخدام بيانات الاعتماد المعتمدة على البيئة لأنه يسهل إبقاؤها خارج كود التطبيق.

## اختيار إمكانات Toolkit

اختر الأدوات حسب اسم المجموعة دون حساسية لحالة الأحرف أو حسب الاسم العام الدقيق للأداة. لا تمرر `groups` و`tool_names` معًا.

```python
from crewai_tools import create_mrscraper_toolkit

# All tools share one configured HTTP client.
all_tools = create_mrscraper_toolkit()

read_tools = create_mrscraper_toolkit(groups=["Account", "Results"])

selected_tools = create_mrscraper_toolkit(
tool_names=[
"mrscraper_search_google_serp",
"mrscraper_fetch_rendered_html",
]
)
```

المجموعات المتاحة هي `Account` و`Discovery` و`Extraction` و`Results` و`Scraper Creation` و`Scraper Runs`.

## القيم المعادة

تُعاد كائنات JSON والمصفوفات والقيم scalar كنص JSON مضغوط حتى تظل مستقرة عند تمريرها عبر Agents وTasks وFlows. تُعاد استجابات HTML والنصوص العادية الأخرى كما يوفرها MrScraper.

## إرشادات التشغيل

- اجعل حدود صفحات الزحف ودفعات URL صغيرة بقدر ما تسمح به Task. يمكن أن تستهلك عمليات الزحف واستدعاءات المتصفح المعروض واستخراج القوائم والتشغيل بالدفعات قدرًا كبيرًا من حصة API.
- لا تُعاد محاولة طلبات POST تلقائيًا لأن ذلك قد يؤدي إلى إنشاء jobs مكررة. تُرسل الحقول المتعلقة بإعادة المحاولة فقط للعمليات التي تدعمها.
- استخرج فقط المحتوى المصرح لك بالوصول إليه. راجع شروط الموقع المستهدف ومتطلبات الخصوصية وسياسة robots والقانون المعمول به، خصوصًا للبيانات الشخصية أو المحمية بتسجيل الدخول.

## استكشاف الأخطاء وإصلاحها

- **الرمز مفقود:** عيّن قيمة غير فارغة لـ `MRSCRAPER_API_TOKEN` قبل إنشاء الأداة.
- **وسيطات غير صالحة:** ترفض أدوات MrScraper المدخلات غير الموثقة. تحقق من schema الأداة واستخدم أسماء الحقول المقبولة بدقة.
- **استدعاءات بطيئة:** قلّل `max_pages` أو عمق الزحف أو حجم الدفعة أو مخرجات المتصفح المطلوبة عند الحاجة.
- **تنسيق إخراج غير متوقع:** يعيد بحث SERP صيغة JSON افتراضيًا؛ عيّن `format="html"` فقط عند الحاجة إلى HTML خام.
6 changes: 5 additions & 1 deletion docs/edge/ar/tools/web-scraping/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ mode: "wide"
<Card title="أدوات Bright Data" icon="spider" href="/ar/tools/web-scraping/brightdata-tools">
تكاملات بحث SERP و Web Unlocker و Dataset API.
</Card>

<Card title="أدوات MrScraper" icon="spider" href="/ar/tools/web-scraping/mrscraper-tools">
استكشاف الويب والاستخراج باستخدام AI والصفحات المعروضة ومسارات عمل scraper القابلة لإعادة الاستخدام.
</Card>
</CardGroup>

## **حالات الاستخدام الشائعة**
Expand Down Expand Up @@ -109,4 +113,4 @@ agent = Agent(
- **المواقع كثيفة JavaScript**: استخدم `SeleniumScrapingTool` للمحتوى الديناميكي
- **التوسع والأداء**: استخدم `FirecrawlScrapeWebsiteTool` للاستخراج بكميات كبيرة
- **البنية التحتية السحابية**: استخدم `BrowserBaseLoadTool` لأتمتة المتصفح القابلة للتوسع
- **سير العمل المعقدة**: استخدم `StagehandTool` لتفاعلات المتصفح الذكية
- **سير العمل المعقدة**: استخدم `StagehandTool` لتفاعلات المتصفح الذكية
128 changes: 128 additions & 0 deletions docs/edge/en/tools/web-scraping/mrscraper-tools.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
title: MrScraper Tools
description: Use MrScraper with CrewAI to reliably scrape and crawl websites, extract public web data, and turn it into clean, structured output for AI workflows.
icon: spider
mode: "wide"
---

# MrScraper Tools

[MrScraper](https://mrscraper.com) provides web discovery, AI extraction, rendered-page fetching, and reusable scraper workflows. The CrewAI integration includes 15 independent tools and a factory for selecting only the capabilities an agent needs.

## Installation

Install `crewai-tools`. The integration uses its existing HTTP dependencies, so no separate MrScraper SDK is required.

```shell
uv add crewai-tools
```

Set your MrScraper API token as an environment variable:

```shell
export MRSCRAPER_API_TOKEN="your-mrscraper-token"
```

Keep the token in an environment variable or secret manager. Do not place it in prompts, task descriptions, source files, or tool arguments that the model can see.

## Quick start

The toolkit factory returns all 15 tools by default. Prefer selecting the smallest relevant group so the agent has a focused toolset.

```python
from crewai import Agent, Crew, Task
from crewai_tools import create_mrscraper_toolkit

researcher = Agent(
role="Web researcher",
goal="Find public product pages and extract structured product data",
backstory="You make focused, cost-aware web extraction calls.",
tools=create_mrscraper_toolkit(groups=["Discovery", "Extraction"]),
)

task = Task(
description="Find the relevant product page and extract its name and price.",
expected_output="A concise summary containing the source URL, product name, and price.",
agent=researcher,
)

result = Crew(agents=[researcher], tasks=[task]).kickoff()
```

## Available tools

| Group | Tool | Use it for | Main inputs |
| --- | --- | --- | --- |
| Account | `MrScraperGetAccountInfoTool` | Inspect account details and usage limits | None |
| Discovery | `MrScraperCrawlWebsiteUrlsTool` | Discover URLs starting from a website | `url`, `max_depth`, `max_pages`, `limit` |
| Discovery | `MrScraperSearchGoogleSerpTool` | Run a synchronous Google SERP search | `query`, `region`, `language`, `page` |
| Extraction | `MrScraperExtractPageByPromptTool` | Extract data from one page with AI instructions | `url`, `prompt`, `output_schema`, `mode` |
| Extraction | `MrScraperExtractListingsTool` | Extract repeated or paginated listings | `url`, `prompt`, `output_schema`, `max_pages` |
| Extraction | `MrScraperExtractStructuredDataTool` | Extract a supported structured-data preset | `url`, `category`, `mode` |
| Extraction | `MrScraperFetchRenderedHtmlTool` | Fetch JavaScript-rendered HTML, Markdown, cookies, or screenshots | `url`, `html`, `markdown`, `screenshot` |
| Results | `MrScraperGetResultsTool` | List paginated results for a scraper | `scraper_id`, `page`, `page_size` |
| Results | `MrScraperGetLatestResultsTool` | Retrieve the newest results for a scraper | `scraper_id`, `count` |
| Results | `MrScraperGetResultDetailTool` | Retrieve one result by ID | `result_id` |
| Scraper Creation | `MrScraperCreatePromptScraperTool` | Create a reusable prompt-based scraper | `url`, `prompt`, `output_schema`, `mode` |
| Scraper Creation | `MrScraperCreateListingScraperTool` | Create a reusable listing scraper | `url`, `prompt`, `output_schema`, `max_pages` |
| Scraper Creation | `MrScraperCreateWebsiteCrawlScraperTool` | Create a reusable website crawl scraper | `url`, `max_depth`, `max_pages`, `limit` |
| Scraper Runs | `MrScraperRunExistingScraperTool` | Run an existing AI or manual scraper for one URL | `scraper_type`, `scraper_id`, `url` |
| Scraper Runs | `MrScraperRunExistingScraperBatchTool` | Run an existing scraper for multiple URLs | `scraper_type`, `scraper_id`, `urls` |

The supported structured-data categories are `article`, `forumThread`, `hotel`, `jobPosting`, `post`, `product`, `property`, `restaurant`, `socialMediaProfile`, and `tourAttraction`.

## Use one tool directly

Use a single tool when the agent or application only needs one capability:

```python
from crewai_tools import MrScraperExtractPageByPromptTool

tool = MrScraperExtractPageByPromptTool()
result = tool.run(
url="https://example.com/products/123",
prompt="Extract the product name and current price",
output_schema={"name": "string", "price": "number"},
)
```

You can also pass `api_token="..."` to a tool constructor or the toolkit factory. Environment-based credentials are recommended because they are easier to keep out of application code.

## Select toolkit capabilities

Select tools by case-insensitive group name or by exact public tool name. Do not pass `groups` and `tool_names` together.

```python
from crewai_tools import create_mrscraper_toolkit

# All tools share one configured HTTP client.
all_tools = create_mrscraper_toolkit()

read_tools = create_mrscraper_toolkit(groups=["Account", "Results"])

selected_tools = create_mrscraper_toolkit(
tool_names=[
"mrscraper_search_google_serp",
"mrscraper_fetch_rendered_html",
]
)
```

Available groups are `Account`, `Discovery`, `Extraction`, `Results`, `Scraper Creation`, and `Scraper Runs`.

## Return values

JSON objects, arrays, and scalar values are returned as compact JSON text so they remain stable when passed through Agents, Tasks, and Flows. HTML and other plain-text responses are returned as provided by MrScraper.

## Operational guidance

- Keep crawl page limits and URL batches as small as the task permits. Crawls, rendered browser calls, listing extraction, and batch runs can consume significant API allowance.
- POST requests are not automatically retried because retrying can create duplicate jobs. Retry-related fields are sent only for operations that support them.
- Only scrape content you are authorized to access. Review the target site's terms, privacy requirements, robots policy, and applicable law, especially for login-protected or personal data.

## Troubleshooting

- **Missing token:** Set a nonblank `MRSCRAPER_API_TOKEN` before constructing a tool.
- **Invalid arguments:** MrScraper tools reject undocumented inputs. Check the tool schema and use the exact accepted field names.
- **Slow calls:** Reduce `max_pages`, crawl depth, batch size, or requested browser outputs where appropriate.
- **Unexpected output format:** SERP searches return JSON by default; set `format="html"` only when raw HTML is required.
5 changes: 5 additions & 0 deletions docs/edge/en/tools/web-scraping/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ These tools enable your agents to interact with the web, extract data from websi
<Card title="Bright Data Tools" icon="spider" href="/en/tools/web-scraping/brightdata-tools">
SERP search, Web Unlocker, and Dataset API integrations.
</Card>

<Card title="MrScraper Tools" icon="spider" href="/en/tools/web-scraping/mrscraper-tools">
Web discovery, AI extraction, rendered pages, and reusable scraper workflows.
</Card>
</CardGroup>

## **Common Use Cases**
Expand Down Expand Up @@ -108,5 +112,6 @@ agent = Agent(
- **Simple Tasks**: Use `ScrapeWebsiteTool` for basic content extraction
- **JavaScript-Heavy Sites**: Use `SeleniumScrapingTool` for dynamic content
- **Scale & Performance**: Use `FirecrawlScrapeWebsiteTool` for high-volume scraping
- **Discovery & Structured Extraction**: Use MrScraper tools for URL discovery, SERP search, rendered pages, and reusable extraction workflows
- **Cloud Infrastructure**: Use `BrowserBaseLoadTool` for scalable browser automation
- **Complex Workflows**: Use `StagehandTool` for intelligent browser interactions
Loading