Dify

Connect MrScraper to Dify to scrape pages as HTML, Markdown, screenshots, brand data, or JSON, search the web, and check account status from agents, chatflows, and workflows.

The MrScraper plugin for Dify adds web scraping, structured extraction, and search to your Dify applications. Use its tools as workflow nodes or let an agent choose when to call them.

Available tools

ToolTool IDPurpose
Statusmrscraper_statusReturn your MrScraper account status, plan, and usage.
Scrape HTMLmrscraper_scrape_htmlRetrieve the raw HTML of a page, optionally with a screenshot.
Scrape Markdownmrscraper_scrape_markdownRetrieve a page as Markdown.
Get screenshotmrscraper_get_screenshotCapture a base64 PNG screenshot of the full page, the top viewport, or a custom viewport.
Scrape brandmrscraper_scrape_brandExtract a website's colors, typography, logos, and social links as JSON.
Scrape JSONmrscraper_scrape_jsonExtract structured JSON from a page using a natural-language prompt.
Web searchmrscraper_web_searchSearch the web and return ranked results with titles, URLs, descriptions, and sources.

This guide covers plugin version 0.4.0, which requires Dify 1.17.0 or later. See the marketplace listing for releases and compatibility details.

Prerequisites

  • A Dify workspace with permission to install tool plugins.
  • A MrScraper API token.
  • A model configured in Dify if you want an agent or LLM node to process the results.

Installation and authentication

Install the plugin

Open MrScraper in the Dify Marketplace, click Install, and select your Dify environment. You can also find MrScraper from the marketplace inside your workspace's Integrations page.

Add your API token

In Dify, open Integrations > Tools > Tool Plugin, select MrScraper, and add a credential. Paste your MrScraper token into API Token and save it.

Dify supplies this credential whenever a MrScraper tool runs. You do not need to pass the token as a tool input or include it in an agent prompt.

Verify the connection

Add a MrScraper Status tool node to a workflow and select the credential you saved. Run the node without inputs and check that it returns your account information.

For help creating a token, see Token Plan. Dify's tools guide explains workspace credentials and using tools across applications.

Page tools

Scrape HTML, Scrape Markdown, Get screenshot, and Scrape JSON retrieve a known URL. For example, configure Scrape Markdown with these inputs to retrieve a page for an LLM:

{
  "url": "https://example.com",
  "max_retries": 2
}

Shared inputs

InputDefaultDescription
urlRequiredAbsolute HTTP or HTTPS URL of the page.
timeout300Page timeout in seconds, from 1 to 330.
wait_for_selectorOmittedCSS selector or text to wait for before returning the page, up to 500 characters.
geo_codeOmittedTwo-letter country code for the request, such as us. See Country Codes.
max_age0Return a cached result of the same request if it is newer than this many milliseconds, up to 604800000 (7 days). 0 always fetches a fresh page. A cached result costs the same tokens as the original scrape.
max_retriesOmittedMaximum number of retries, as a nonnegative integer. Omit for no limit.

Scrape HTML, Scrape Markdown, and Scrape JSON also accept these loading inputs:

InputDefaultDescription
browser_renderingautotrue always uses a browser and false never does. auto tries without a browser first and switches automatically when needed.
warm_startfalseVisit the site's home page before the target URL.
block_resourcesfalseBlock images, fonts, and stylesheets.

Scrape HTML

Returns the page HTML. Set screenshot to also capture the page:

ValueResult
false (default)No screenshot.
fullThe entire scroll height.
topThe first viewport.
WIDTHxHEIGHT[-ZOOM]A custom viewport from 100 to 3840 pixels with an optional zoom from 25 to 300, such as 1280x800 or 1920x1080-75.

Any value other than false also enables browser rendering.

Scrape Markdown

Returns the page as Markdown. It takes only the shared and loading inputs.

Get screenshot

Returns a base64 PNG screenshot. Browser rendering is always enabled. Set screenshot to full (default), top, or WIDTHxHEIGHT[-ZOOM]; any other value, including false, is rejected before a request is sent.

Scrape JSON

Extracts structured data from the page with AI.

InputDefaultDescription
promptExtract all data as complete as possible.What to extract. Append Json Schema: and a JSON schema to shape the output.
htmltrueInclude the page HTML in the response.
screenshotfalseInclude a base64 screenshot. Unlike the other tools, this input is a boolean.
{
  "url": "https://example.com/products",
  "prompt": "Extract the first 2 items with title and price. Json Schema: {\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"title\":{\"type\":\"string\"},\"price\":{\"type\":\"string\"}},\"required\":[\"title\",\"price\"]}}",
  "html": false
}

See the Scraper API guide for retrieval use cases.

Scrape brand

Scrape brand takes only url and returns the site's colors, typography, logos, and social links as JSON. See Scrape Brand.

Use Web search when you have a topic or keyword rather than a target page. It always returns structured JSON results.

{
  "query": "web scraping tutorials",
  "country": "us",
  "num_results": 10
}
InputDefaultDescription
queryRequiredThe search query, from 1 to 1000 characters.
countryOmittedOptional two-letter country code for localized results, such as us.
num_results10Number of results to return, from 10 to 100.

Each result includes its rank, title, url, description, and source.

Example: summarize a web page

Build a workflow that accepts a URL, retrieves its content, and produces a summary:

  1. Add a User Input node with a required text input named page_url.
  2. Choose Add Node > Tools > MrScraper > Scrape Markdown.
  3. Bind the tool's url input to page_url.
  4. Test the tool node and inspect its output. Bind the returned Markdown to an LLM node with an instruction such as Summarize this page in three bullet points.
  5. Connect the LLM response to an Output node, then test the workflow with https://example.com.

For research workflows, run Web search first, select a result URL from its output, and pass that URL to Scrape Markdown before summarizing the page. To get structured fields instead of a summary, use Scrape JSON with a prompt and schema. See Dify's Tool node guide for adding nodes and choosing credentials.

Use MrScraper in an agent

Add Web search, Scrape Markdown, and any other MrScraper tools you need to your agent's available tools, and select your MrScraper credential. The agent can fill in the search query, page URL, and extraction prompt on its own.

An example agent instruction:

Search the web for pages relevant to the user's question. Fetch the most useful pages with Scrape Markdown, then answer using the retrieved content and cite the source URLs.

Working with outputs

The plugin returns the API response data directly. Objects and arrays appear as Dify JSON messages; strings such as HTML and Markdown appear as text. HTTP status and response headers are not included in the tool output.

Page tools use the page timeout plus 30 seconds of transport, up to 360 seconds. Scrape brand and Web search use a fixed 120-second deadline, and Status uses 600 seconds. The plugin's maximum request time is 660 seconds.

Inspect a test run before connecting a tool's output to another node. Screenshot data is returned as base64 inside the JSON response; the plugin does not create a separate Dify file.

Troubleshooting

IssueWhat to check
Plugin will not installConfirm your Dify version meets the plugin requirement and your workspace permissions allow installation.
Authentication failsCheck the provider's API Token credential and verify it with Status.
Get screenshot rejects the inputSet screenshot to full, top, or WIDTHxHEIGHT[-ZOOM].
Web search rejects the result countSet num_results to an integer from 10 to 100.
A downstream node receives an unexpected valueInspect the tool's JSON or text output and bind the specific content your next node needs.
A request times outCheck the tool timeout and any shorter limits imposed by your Dify deployment or reverse proxy.

For self-hosted Dify, allow outbound HTTPS access to api.app.mrscraper.com and api.mrscraper.com.

Upgrading

  • From 0.2.x: Account is now Status (mrscraper_status). Scraper API (mrscraper_scraper_api) is replaced by Scrape HTML, Scrape Markdown, and Get screenshot; recreate affected nodes with the tool that matches the format you used. Scrape brand and Scrape JSON are new. home_page is now warm_start, and max_age is new. The use_proxy, proxy_country, proxy, bypass_proxy, super, wait_until, cookie_jar, headers, token_cap, stream, and discard_token_secret inputs were removed. Web search is unchanged.
  • From 0.1.x or earlier: Recreate all MrScraper nodes with the tools listed above and reconnect their bindings. Crawl, scraper creation, rerun, and saved-result operations have no equivalent.

On this page