Skip to content

feat: add MrScraper components for Langflow - #12542

Open
ai-mrscraper wants to merge 9 commits into
langflow-ai:mainfrom
ai-mrscraper:feat/component-mrscraper
Open

feat: add MrScraper components for Langflow#12542
ai-mrscraper wants to merge 9 commits into
langflow-ai:mainfrom
ai-mrscraper:feat/component-mrscraper

Conversation

@ai-mrscraper

@ai-mrscraper ai-mrscraper commented Apr 7, 2026

Copy link
Copy Markdown

Summary

Add MrScraper as a new tool integration — 8 components covering AI scraping, website crawling, rendered HTML fetch, batch reruns, and result listing/detail.

MrScraper provides AI-powered and manual web scraping: natural-language extraction, map-based crawling, stealth browser HTML, and dashboard-style scraper reruns with paginated results.

Components added (8)

All components live under src/lfx/src/lfx/components/mrscraper/ and are registered in src/lfx/src/lfx/components/__init__.py.

Category Components Count
Scrape & crawl MrScraper AI Agent Scraper, MrScraper Crawl Website, MrScraper Run AI Scraper, MrScraper Run Manual Scraper, MrScraper Batch Scrape URLs 5
Fetch & results MrScraper Fetch Rendered HTML, MrScraper Get Results, MrScraper Get Result Detail 3

Implementation notes

  • All components inherit from Component.
  • Authentication: SecretStrInput for the MrScraper API token.
  • Agent / tool use: Primary inputs (URLs, prompts, scraper IDs, etc.) use tool_mode=True where appropriate for agent workflows.
  • SDK: Calls go through the official mrscraper Python SDK (pip install mrscraper-sdk); components raise a clear import error if the extra is not installed.
  • Outputs: Structured responses as Data (consistent with other LFX integrations).

Frontend

  • Sidebar / palette: MrScraper entry in src/frontend/src/utils/styleUtils.ts.
  • Icon: MrScraper wired in eagerIconImports.ts and lazyIconImports.ts (SVG under src/frontend/src/icons/Mrscraper/).

Dependencies

  • mrscraper-sdk — optional extra on langflow-base (e.g. langflow-base[mrscraper]), version range as defined in src/backend/base/pyproject.toml.

Links


Release notes (optional)

New features

  • Added MrScraper integration: AI and manual scraping, website crawl (map agent), rendered HTML fetch, batch URL reruns, and paginated result listing with single-result detail.

Component / UI

  • Registered MrScraper in the component palette with a dedicated icon for the sidebar and canvas.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added MrScraper integration with multiple web scraping components, including AI-powered scraping, manual scraping, website crawling, HTML fetching, batch operations, and result retrieval capabilities.
    • MrScraper is now available as an optional integration in the UI sidebar with full icon support.

@github-actions github-actions Bot added the community Pull Request from an external contributor label Apr 7, 2026
@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7faadedd-513e-4faa-98d3-1f5a383acec6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR integrates MrScraper SDK support by adding backend dependencies, frontend icon assets and UI registration, and eight new LFX components that expose MrScraper scraping, result retrieval, and batch operation capabilities.

Changes

Cohort / File(s) Summary
Backend Dependencies
src/backend/base/pyproject.toml
Added mrscraper-sdk>=0.1.2,<1.0.0 as optional dependency extra and included it in the complete installation set.
Frontend Icon Components
src/frontend/src/icons/Mrscraper/MrscraperIcon.jsx, src/frontend/src/icons/Mrscraper/index.tsx
Created new SVG icon component with forwardRef wrapper exporting MrscraperIcon for use throughout the frontend.
Frontend Icon Registration
src/frontend/src/icons/eagerIconImports.ts, src/frontend/src/icons/lazyIconImports.ts
Registered MrscraperIcon in both eager and lazy icon mapping imports for dynamic/static icon resolution.
Frontend Styling Configuration
src/frontend/src/utils/styleUtils.ts
Added MrScraper sidebar bundle entry and mapped MrScraper node type to Mrscraper icon in display mapping.
Component Registry
src/lfx/src/lfx/components/__init__.py
Registered mrscraper module in dynamic imports and __all__ for component discovery.
MrScraper Component Package
src/lfx/src/lfx/components/mrscraper/__init__.py
Created lazy-loading module with __getattr__ pattern exposing eight MrScraper component classes and caching on first access.
MrScraper Scraping Components
src/lfx/src/lfx/components/mrscraper/mrscraper_ai_scraper.py, mrscraper_crawl_website.py, mrscraper_fetch_html.py
Three components wrapping MrScraper SDK methods for AI scraping, website crawling with depth/page limits, and fetching rendered HTML.
MrScraper Result & Batch Components
src/lfx/src/lfx/components/mrscraper/mrscraper_get_result.py, mrscraper_get_results.py, mrscraper_batch_scrape.py
Three components for retrieving single results by ID, fetching all results with pagination/filtering, and running batch scrapes on multiple URLs.
MrScraper Execution Components
src/lfx/src/lfx/components/mrscraper/mrscraper_run_ai_scraper.py, mrscraper_run_manual_scraper.py
Two components for rerunning existing AI and manual scrapers on new target URLs with configurable parameters.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error The PR adds 8 new MrScraper backend components and 3 frontend icon components with zero test files, despite the repository having 447 established test files and clear testing conventions. Create comprehensive unit tests in src/lfx/tests/unit/components/mrscraper/ following test_*.py naming convention, covering input/output validation, async execution, error handling, and identified bugs like max_depth=0 fallback and mode validation. Add integration tests for end-to-end workflows with mocked API responses.
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Quality And Coverage ⚠️ Warning PR adds 8 new async components (668 lines) with zero test files, violating documented testing requirements for comprehensive unit tests. Add comprehensive unit tests for all 8 MrScraper components in src/backend/tests/unit/components/bundles/mrscraper/ with required fixtures, SDK mocking, and async patterns.
Test File Naming And Structure ❓ Inconclusive Test files for MrScraper components could not be located or verified to follow required patterns in the repository. Provide test file locations, naming conventions used, and test coverage details for the 8 new backend components and frontend icon changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main changeset: adding MrScraper components to Langflow. It reflects the primary purpose of the PR without being vague or misleading.
Excessive Mock Usage Warning ✅ Passed No test files were added or modified in this PR, making the assessment of excessive mock usage not applicable.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ai-mrscraper ai-mrscraper changed the title Feat/component mrscraper feat: add MrScraper components for Langflow Apr 7, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 7, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 7, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 7, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 7, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
src/frontend/src/icons/Mrscraper/MrscraperIcon.jsx (1)

1-30: Missing dark mode support for the icon.

As per coding guidelines, SVG icon components should use the isDark prop to switch between light and dark color schemes. Currently, the fill color #1BD0EF is hardcoded without dark mode handling.

♻️ Proposed fix to add dark mode support
-const SvgMrscraperLogo = (props) => (
+const SvgMrscraperLogo = ({ isDark, ...props }) => (
   <svg
     viewBox="0 0 180 180"
     xmlns="http://www.w3.org/2000/svg"
     preserveAspectRatio="xMidYMid meet"
     {...props}
   >
     <path
       d="M0 0 C1.53741858 1.14472235 ..."
-      fill="#1BD0EF"
+      fill={isDark ? "#1BD0EF" : "#1BD0EF"}
       transform="translate(141.4375,20.5)"
     />
     {/* Apply same pattern to other path elements */}
   </svg>
 );

Note: If the MrScraper brand color should remain consistent across light/dark modes, you can keep the same color for both, but the pattern should still be in place for consistency with other icons in the codebase.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/frontend/src/icons/Mrscraper/MrscraperIcon.jsx` around lines 1 - 30, The
SvgMrscraperLogo component hardcodes fill="#1BD0EF" on each <path>, missing
dark-mode support; update SvgMrscraperLogo to accept an isDark prop (or read it
from props), derive a fillColor variable (use the existing brand hex for light
and an appropriate dark variant or the same if brand requires), and replace the
hardcoded fill="#1BD0EF" on every path with the computed fillColor so the SVG
switches colors based on isDark while keeping the component signature
(SvgMrscraperLogo(props)) intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/lfx/src/lfx/components/mrscraper/mrscraper_ai_scraper.py`:
- Line 73: The code currently passes the literal string "None" for missing
proxy_country; change the parameter passed to the mrscraper call to use a Python
None (null) instead of the string. Locate the call that sets proxy_country
(e.g., proxy_country=self.proxy_country or "None") in mrscraper_ai_scraper.py
and replace the string fallback with None (or omit the field when
self.proxy_country is falsy) so the SDK receives a true null/absent value rather
than the invalid country string.

In `@src/lfx/src/lfx/components/mrscraper/mrscraper_batch_scrape.py`:
- Around line 69-78: The code silently treats any non-"AI" mode as manual;
update the check in mrscraper_batch_scrape.py to validate self.mode explicitly
(e.g., if self.mode == "AI": call client.bulk_rerun_ai_scraper(...); elif
self.mode == "Manual": call client.bulk_rerun_manual_scraper(...); else: raise a
clear exception such as ValueError or RuntimeError that includes the invalid
self.mode and scraper_id) so unsupported modes fail fast instead of defaulting
to manual; reference the methods bulk_rerun_ai_scraper and
bulk_rerun_manual_scraper and the attribute self.scraper_id when constructing
the error message.

In `@src/lfx/src/lfx/components/mrscraper/mrscraper_crawl_website.py`:
- Line 79: The call currently uses "max_depth=self.max_depth or 2", which treats
0 as falsy and overrides a valid 0; change the fallback to an explicit None
check so a user-specified 0 is preserved (e.g., replace the "or 2" pattern with
a conditional that uses self.max_depth if self.max_depth is not None, otherwise
2). Update the parameter passed to max_depth in the method call that references
self.max_depth (in mrscraper_crawl_website.py) so it uses the explicit
None-check expression instead of the boolean "or" fallback.

In `@src/lfx/src/lfx/components/mrscraper/mrscraper_get_result.py`:
- Around line 34-43: The get_result method currently wraps the whole response
from MrScraper.get_result_by_id into Data, but that SDK returns a dict
{"status_code": ..., "data": ..., "headers": ...}; update get_result to extract
only the "data" field from the response before creating Data. Specifically, in
async def get_result(self) use the MrScraper client (constructed with
self.api_token) to await client.get_result_by_id(result_id=self.result_id), then
pass result["data"] into Data(data=...) instead of the full result dict.

In `@src/lfx/src/lfx/components/mrscraper/mrscraper_run_ai_scraper.py`:
- Line 88: The call that sets max_depth is overwriting an explicit 0 because it
uses a truthy fallback (max_depth=self.max_depth or 2); change the fallback to
only apply when self.max_depth is None so that an explicit 0 is honored. Locate
where max_depth is passed (the argument name max_depth in the call, referencing
self.max_depth) and replace the truthy-coalescing logic with a None-check (use
self.max_depth if not None, otherwise 2) so explicit 0 values are preserved.

---

Nitpick comments:
In `@src/frontend/src/icons/Mrscraper/MrscraperIcon.jsx`:
- Around line 1-30: The SvgMrscraperLogo component hardcodes fill="#1BD0EF" on
each <path>, missing dark-mode support; update SvgMrscraperLogo to accept an
isDark prop (or read it from props), derive a fillColor variable (use the
existing brand hex for light and an appropriate dark variant or the same if
brand requires), and replace the hardcoded fill="#1BD0EF" on every path with the
computed fillColor so the SVG switches colors based on isDark while keeping the
component signature (SvgMrscraperLogo(props)) intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5f18e504-7bc3-4e7e-af50-7b0c9d30d093

📥 Commits

Reviewing files that changed from the base of the PR and between 1e61ac4 and 8ba13dc.

⛔ Files ignored due to path filters (2)
  • src/frontend/src/icons/Mrscraper/mrscraper.svg is excluded by !**/*.svg
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (16)
  • src/backend/base/pyproject.toml
  • src/frontend/src/icons/Mrscraper/MrscraperIcon.jsx
  • src/frontend/src/icons/Mrscraper/index.tsx
  • src/frontend/src/icons/eagerIconImports.ts
  • src/frontend/src/icons/lazyIconImports.ts
  • src/frontend/src/utils/styleUtils.ts
  • src/lfx/src/lfx/components/__init__.py
  • src/lfx/src/lfx/components/mrscraper/__init__.py
  • src/lfx/src/lfx/components/mrscraper/mrscraper_ai_scraper.py
  • src/lfx/src/lfx/components/mrscraper/mrscraper_batch_scrape.py
  • src/lfx/src/lfx/components/mrscraper/mrscraper_crawl_website.py
  • src/lfx/src/lfx/components/mrscraper/mrscraper_fetch_html.py
  • src/lfx/src/lfx/components/mrscraper/mrscraper_get_result.py
  • src/lfx/src/lfx/components/mrscraper/mrscraper_get_results.py
  • src/lfx/src/lfx/components/mrscraper/mrscraper_run_ai_scraper.py
  • src/lfx/src/lfx/components/mrscraper/mrscraper_run_manual_scraper.py

url=self.url,
message=self.message,
agent=self.agent,
proxy_country=self.proxy_country or "None",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

In the mrscraper Python SDK, what values are valid for create_scraper(..., proxy_country=...) when no proxy country is desired? Is Python None supported, and is the string "None" considered invalid?

💡 Result:

When you don’t want a proxy country, the MrScraper API treats proxyCountry as optional—so the “no proxy country” value is to omit the field entirely. (docs.mrscraper.com)

In the mrscraper-sdk Python client, create_scraper(..., proxy_country=...) is designed with that same intent: you should either not pass proxy_country at all, or pass Python None (so the client can omit it / send it as JSON null, depending on implementation). (pypi.org)

The literal string "None" is not a special value; it would be sent as a regular country code string, and since proxyCountry is documented as a proxy country code, "None" should be treated as invalid. (docs.mrscraper.com)

Citations:


Use None (null) for missing proxy_country, not the string "None".

The mrscraper SDK documentation confirms that proxyCountry is optional and expects either Python None or the field to be omitted entirely. The literal string "None" is not a valid country code and will be rejected by the API.

🔧 Proposed fix
-            proxy_country=self.proxy_country or "None",
+            proxy_country=self.proxy_country or None,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
proxy_country=self.proxy_country or "None",
proxy_country=self.proxy_country or None,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lfx/src/lfx/components/mrscraper/mrscraper_ai_scraper.py` at line 73, The
code currently passes the literal string "None" for missing proxy_country;
change the parameter passed to the mrscraper call to use a Python None (null)
instead of the string. Locate the call that sets proxy_country (e.g.,
proxy_country=self.proxy_country or "None") in mrscraper_ai_scraper.py and
replace the string fallback with None (or omit the field when self.proxy_country
is falsy) so the SDK receives a true null/absent value rather than the invalid
country string.

Comment on lines +69 to +78
if self.mode == "AI":
result = await client.bulk_rerun_ai_scraper(
scraper_id=self.scraper_id,
urls=url_list,
)
else:
result = await client.bulk_rerun_manual_scraper(
scraper_id=self.scraper_id,
urls=url_list,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Unexpected mode values currently default to Manual silently.

Please fail fast for unsupported values instead of routing to manual implicitly.

🔧 Proposed fix
-        if self.mode == "AI":
+        if self.mode == "AI":
             result = await client.bulk_rerun_ai_scraper(
                 scraper_id=self.scraper_id,
                 urls=url_list,
             )
-        else:
+        elif self.mode == "Manual":
             result = await client.bulk_rerun_manual_scraper(
                 scraper_id=self.scraper_id,
                 urls=url_list,
             )
+        else:
+            msg = f"Unsupported mode: {self.mode!r}. Expected 'AI' or 'Manual'."
+            raise ValueError(msg)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if self.mode == "AI":
result = await client.bulk_rerun_ai_scraper(
scraper_id=self.scraper_id,
urls=url_list,
)
else:
result = await client.bulk_rerun_manual_scraper(
scraper_id=self.scraper_id,
urls=url_list,
)
if self.mode == "AI":
result = await client.bulk_rerun_ai_scraper(
scraper_id=self.scraper_id,
urls=url_list,
)
elif self.mode == "Manual":
result = await client.bulk_rerun_manual_scraper(
scraper_id=self.scraper_id,
urls=url_list,
)
else:
msg = f"Unsupported mode: {self.mode!r}. Expected 'AI' or 'Manual'."
raise ValueError(msg)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lfx/src/lfx/components/mrscraper/mrscraper_batch_scrape.py` around lines
69 - 78, The code silently treats any non-"AI" mode as manual; update the check
in mrscraper_batch_scrape.py to validate self.mode explicitly (e.g., if
self.mode == "AI": call client.bulk_rerun_ai_scraper(...); elif self.mode ==
"Manual": call client.bulk_rerun_manual_scraper(...); else: raise a clear
exception such as ValueError or RuntimeError that includes the invalid self.mode
and scraper_id) so unsupported modes fail fast instead of defaulting to manual;
reference the methods bulk_rerun_ai_scraper and bulk_rerun_manual_scraper and
the attribute self.scraper_id when constructing the error message.

url=self.url,
message="",
agent="map",
max_depth=self.max_depth or 2,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

max_depth=0 is currently ignored due to falsy fallback.

Line 79 overrides a valid 0 value (0 = start URL only per Line 35) back to 2, changing user intent.

🔧 Proposed fix
-            max_depth=self.max_depth or 2,
+            max_depth=2 if self.max_depth is None else self.max_depth,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
max_depth=self.max_depth or 2,
max_depth=2 if self.max_depth is None else self.max_depth,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lfx/src/lfx/components/mrscraper/mrscraper_crawl_website.py` at line 79,
The call currently uses "max_depth=self.max_depth or 2", which treats 0 as falsy
and overrides a valid 0; change the fallback to an explicit None check so a
user-specified 0 is preserved (e.g., replace the "or 2" pattern with a
conditional that uses self.max_depth if self.max_depth is not None, otherwise
2). Update the parameter passed to max_depth in the method call that references
self.max_depth (in mrscraper_crawl_website.py) so it uses the explicit
None-check expression instead of the boolean "or" fallback.

Comment on lines +34 to +43
async def get_result(self) -> Data:
try:
from mrscraper import MrScraper
except ImportError as e:
msg = "Could not import mrscraper SDK. Please install it with `pip install mrscraper-sdk`."
raise ImportError(msg) from e

client = MrScraper(token=self.api_token)
result = await client.get_result_by_id(result_id=self.result_id)
return Data(data=result)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

What is the API for the mrscraper-sdk Python package? How do you use MrScraper class and get_result_by_id method?

💡 Result:

mrscraper-sdk Python API (core)

Install:

pip install mrscraper-sdk

The package exposes a single main async client class: MrScraper. You initialize it with your API token, and all methods are coroutines (must be awaited). (pypi.org)

MrScraper class (methods)

  • fetch_html(url, *, timeout, geo_code, block_resources)
  • create_scraper(url, message, *, agent, proxy_country, ...)
  • rerun_scraper(scraper_id, url, *, max_depth, max_pages, limit, ...)
  • bulk_rerun_ai_scraper(scraper_id, urls)
  • rerun_manual_scraper(scraper_id, url)
  • bulk_rerun_manual_scraper(scraper_id, urls)
  • get_all_results(*, sort_field, sort_order, page_size, page, search, ...)
  • get_result_by_id(result_id) (pypi.org)

All methods return a dict shaped like:
{"status_code": int, "data": Any, "headers": dict} (pypi.org)


How to use MrScraper and get_result_by_id

import asyncio
from mrscraper import MrScraper

async def main():
    client = MrScraper(token="MRSCRAPER_API_TOKEN")

    # Fetch one result by its ID
    resp = await client.get_result_by_id("result_12345")

    print(resp["status_code"])
    print(resp["data"])      # parsed JSON body (result detail)
    # print(resp["headers"])

asyncio.run(main())

get_result_by_id(result_id) “fetch[es] a single result by its ID”. (pypi.org)

Citations:


Fix response data extraction from MrScraper SDK.

The mrscraper SDK's get_result_by_id() method returns a dict with shape {"status_code": int, "data": Any, "headers": dict}. The code currently passes the entire response dict to Data(), but should extract only the data field:

Suggested fix
result = await client.get_result_by_id(result_id=self.result_id)
return Data(data=result["data"])
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lfx/src/lfx/components/mrscraper/mrscraper_get_result.py` around lines 34
- 43, The get_result method currently wraps the whole response from
MrScraper.get_result_by_id into Data, but that SDK returns a dict
{"status_code": ..., "data": ..., "headers": ...}; update get_result to extract
only the "data" field from the response before creating Data. Specifically, in
async def get_result(self) use the MrScraper client (constructed with
self.api_token) to await client.get_result_by_id(result_id=self.result_id), then
pass result["data"] into Data(data=...) instead of the full result dict.

result = await client.rerun_scraper(
scraper_id=self.scraper_id,
url=self.url,
max_depth=self.max_depth or 2,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

max_depth=0 cannot be honored with current fallback logic.

Line 88 converts an explicit 0 to 2, which conflicts with the documented behavior on Line 42.

🔧 Proposed fix
-            max_depth=self.max_depth or 2,
+            max_depth=2 if self.max_depth is None else self.max_depth,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
max_depth=self.max_depth or 2,
max_depth=2 if self.max_depth is None else self.max_depth,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lfx/src/lfx/components/mrscraper/mrscraper_run_ai_scraper.py` at line 88,
The call that sets max_depth is overwriting an explicit 0 because it uses a
truthy fallback (max_depth=self.max_depth or 2); change the fallback to only
apply when self.max_depth is None so that an explicit 0 is honored. Locate where
max_depth is passed (the argument name max_depth in the call, referencing
self.max_depth) and replace the truthy-coalescing logic with a None-check (use
self.max_depth if not None, otherwise 2) so explicit 0 values are preserved.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 7, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 7, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 7, 2026
@ai-mrscraper
ai-mrscraper force-pushed the feat/component-mrscraper branch from d5a6017 to 7345dcf Compare April 9, 2026 01:29
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 9, 2026
@ai-mrscraper

Copy link
Copy Markdown
Author

Hi team, just following up on this PR.

I noticed the integration is already in place, but it looks like the PR is still blocked by pending review and a few failing checks. From the thread, there were also earlier concerns around test coverage and some component issues that may have affected the review flow.

Would appreciate it if someone could take a look and let me know what is still needed from my side to move this forward. Happy to address any remaining feedback. Thanks!

@ai-mrscraper

Copy link
Copy Markdown
Author

Hi @vjgit96 and @Adam-Aghili

Would you mind taking a look at this PR when you have a chance

#12542

We added the MrScraper integration and would really appreciate your review and any feedback

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Pull Request from an external contributor enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants