# Zach's "Webpage Content To Markdown" Scraper (`dyf/webpage-to-markdown`) Actor

Scrape a webpage and parse to markdown.

Packed with features to ensure high success rate and low cost.

Includes 2 modes of operation so that you can optimize for either cost (as cheap as possible) or yield (as many successful results as possible).

- **URL**: https://apify.com/dyf/webpage-to-markdown.md
- **Developed by:** [Double Your Freelancing](https://apify.com/dyf) (community)
- **Categories:** Lead generation, AI, Automation
- **Features:** Limited permissions
- **Stats:** 40 total users, 0 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Zach's "Webpage Content To Markdown" Scraper

This Apify actor scrapes a single webpage and parses to markdown. Includes browser-based scraping, smart retrying, anti-scrape block (e.g. cloudflare) circumvention, and smart proxy support to ensure a high success rate.

It also includes 2 modes of operation so that you can optimize for either cost (as cheap as possible) or yield (as many successful results as possible).

### 🤔 When To Use It

Whenever you want to reliably get a webpage's content and parse it into markdown.

(I personally mostly use it for feeding data into ChatGPT for freelance cold outreach personalization & automation tasks, which I cover in our [$200k Freelancer course](https://doubleyourfreelancing.com/200kfreelancer/).)

### 😰 Why We Made it:

If you want to have ChatGPT interpret a webpage, it can be surprisingly difficult with current tooling.

- 😭 ChatGPT's API isn't currently web-connected
- 😿 If you try to get a page's content via a Make automation and parse it to text/markdown, it's unreliable and produces a lot of soft failures and rendering errors
- 🤢 If you try to use standalone tools for webpage scraping to markdown conversion, they're expensive and also have a lot of soft failures & markdown rendering errors
- 😣 If you use the other website-crawling-to-markdown scrapers on Apify they tend to be expensive and unreliable.

That's why we made this Actor...

### 💪 Why This Actor is Nifty:

😍 This actor allows you to simply plop in a big ole list of domain names, and get a huge spreadsheet of markdown content back, to do whatever you want with.

(e.g. upload to google sheets and have ChatGPT iterate through via Make automation)

### 🤘 Features:

- ✅ **Anti-Scrape Circumvention** — if you use the "Get Data Using Browser" option, we'll be able to circumvent many blocks
- ✅ **Soft-Failure Reporting** — e.g. if a webpage comes back blank, we'll mark it as a failure — not a lot of other solutions do this)
- ✅ **Smart Proxy Support** — we'll run on Datacenter proxies by default, and only revert to Residential proxies when actually necessary
- ✅ **Smart Retrying** — we'll auto retry on failures and rotate proxies and IPs to get you the most successful results possible

### 💭 Example Use Cases:

If you're a [$200k Freelancer course](https://doubleyourfreelancing.com/200kfreelancer/) student, be sure to check the course training area for guidance on the below use cases and more.

##### Website Language Detection:

1. Run this actor
2. Put results into a Google Sheet
3. Filter out the fails
4. Add the formula `=DETECTLANGUAGE(E2)` (assuming `E` is the markdown column) to a new column
5. Extend that formula to all rows in the column
6. Filter results to not show languages you don't want (e.g. filter to only show `en` for only English language websites

##### Cold Outreach Personalization:

(e.g. find out what kinds of products a company sells, who their audience avatar is, etc.)

1. Run this actor
2. Put results into a Google Sheet
3. Filter out the fails
4. Create a Make automation that feeds the markdown into ChatGPT for analysis
5. Have ChatGPT give you its analyses back as JSON if you want multiple fields / analyses back (e.g. "type_of_products_sold," "random_product_name," etc.
6. Parse the JSON and add each field to a column in the Google Sheet
7. You can now feed these data into a line-writer ChatGPT prompt to have it rewrite a template line with this personalization data

## Modes of Operation

Regardless of which mode you use it in, if you're exporting to a spreadsheet, be sure to choose MS Excel format, not CSV. (Markdown will often mess up the CSV file)

### "Low-Hanging Fruit" Mode

The following settings are efficient and the cheapest path to data, but won't work for a lot of websites:

- "Get Data Using Browser" option **disabled**
- 1GB of RAM
- Residential proxies (we use datacenter by default in our code and will only use residential if actually necessary)

##### Estimated Costs for "Low-Hanging Fruit" Mode:

- Est. cost per result in "Low-Hanging Fruit" Mode: $0.00025
- Est. yield on results: 84.12%

### "All The Damned Fruit" Mode

The following settings have very high reliability, but are more expensive:

- "Get Data Using Browser" option **enabled**
- 4GB of RAM (You can often get away with 2GB – or even 1GB – of RAM, which will make it much cheaper.)
- Residential proxies (we use datacenter by default in our code and will only use residential if actually necessary)

##### Estimated Costs for "All The Damned Fruit" Mode:

- Est. cost per result in "All The Damned Fruit" Mode: $0.0069 CPL for residential proxies ($0.0012 CPL for datacenter)
- Est. yield on results: 93.38% for residential (91.64% datacenter)

### Pricing Breakdown:

| Results | Valid Results | Cost   | Cost Per Result (CPL) | Yield   | Time   | Memory | Proxy          | Using Browser Build |
|---------|---------------|--------|-----------------------|---------|--------|--------|----------------|---------------------|
| 2462    | 2071          | $0.612 | $0.0002486            | 84.12%  | 36min  | 1 GB   | Residential    | No                  |
| 2463    | 2078          | $0.914 | $0.0003711            | 84.37%  | 19min  | 4 GB   | Residential    | No                  |
| 2463    | 2257          | $2.99  | $0.0012140            | 91.64%  | 96min  | 4 GB   | Datacenter     | Yes                 |
| 2463    | 2300          | $15-46 | As high as $0.02      | 93.38%  | 120min | 4 GB   | If Residential | Yes                 |

## Suggested Usage

Depending on your priorities, there are a couple ways to use this scraper. What's your priority?

#### "My Priority is EASE"

*("...And I don't care if it costs more.")*

👉 Run it with the settings from the "All The Damned Fruit" Mode from the 'Modes of Operation" instructions right from the start.

Just be aware that at 4GB of RAM + residential proxies, you will have to pay up to 100x more than if you did the "low-hanging fruit mode" first.

If you're exporting to a spreadsheet, be sure to choose MS Excel format, not CSV. (Markdown will often mess up the CSV file)

#### "My Priority is COST"

*("...And I don't care if it means there are a couple extra steps for me.")*

👉 You'll do two separate runs — first you'll get all the cheap Low-Hanging Fruit results you can, then you'll re-run all the failures in the "All The Damned Fruit" Mode.

Instructions:

1. Run for your full set of URLs with the `"Low-Hanging Fruit" Mode` settings (You can find them in the `Modes of Operation` section at the top of this page)
2. After the run is finished, export the results to Excel format and filter the list to only show the failures
3. Re-run these failures with the settings from the `"All The Damned Fruit" Mode` settings (You can find them in the `Modes of Operation` section at the top of this page)
4. Export the results from both runs and merge the data manually into one sheet

## All Config Options

- Maximum Content Length (Characters) — This will trim each record's markdown output before we add it to the result set. Cuts down on spreadsheet filesize. (Our hard-set internal trim maximum is 10,000 characters)

# Actor input Schema

## `startUrls` (type: `array`):

A list of URLs or domains to start with. For domains, the script will automatically prepend 'https://'.

## `minContentLengthChars` (type: `integer`):

If the content length is less than this value, the crawler will mark the page as a soft fail.
Enter 0 for no limit.

## `maxContentLengthChars` (type: `integer`):

Enter 0 for no limit.

## `getDataUsingBrowser` (type: `boolean`):

If true, the crawler will use a headless browser to get the HTML content of the page.

## `proxyConfigurationSettings` (type: `object`):

Select proxies to be used by your crawler.

## Actor input object example

```json
{
  "startUrls": [
    "https://doubleyourfreelancing.com/"
  ],
  "minContentLengthChars": 500,
  "maxContentLengthChars": 0,
  "getDataUsingBrowser": true,
  "proxyConfigurationSettings": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        "https://doubleyourfreelancing.com/"
    ],
    "proxyConfigurationSettings": {
        "useApifyProxy": true,
        "apifyProxyGroups": []
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("dyf/webpage-to-markdown").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startUrls": ["https://doubleyourfreelancing.com/"],
    "proxyConfigurationSettings": {
        "useApifyProxy": True,
        "apifyProxyGroups": [],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("dyf/webpage-to-markdown").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    "https://doubleyourfreelancing.com/"
  ],
  "proxyConfigurationSettings": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}' |
apify call dyf/webpage-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dyf/webpage-to-markdown"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/bi35UKbJxEvX3nz8G/builds/T9VgeXJlvOsbZFfK6/openapi.json
