# Web Content Scraper (`ayen-data/web-content-scraper`) Actor

Fetches a list of web pages and extracts clean article text, markdown, and publication metadata.

- **URL**: https://apify.com/ayen-data/web-content-scraper.md
- **Developed by:** [Anyx Solutions](https://apify.com/ayen-data) (community)
- **Categories:** AI, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.90 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

![banner](https://i.ibb.co/j963p2JC/web-content-scraper.png)

## Web Content Scraper

**Turn any list of web pages into clean article text, markdown, and publication metadata.**

Give this scraper a list of URLs and it returns the part of each page that actually matters. Navigation, footers, cookie banners, ad slots, and share widgets are stripped out, leaving the article body as both plain text and markdown, alongside the title, author, site name, language, and publication date. Because the boilerplate is removed before extraction, re-running the same page returns identical text — so you can reliably detect when content has genuinely changed. It is built for AI and LLM pipelines, RAG and vector-database ingestion, content monitoring, and research archives.

### ⚡ Quick start

```json
{
  "startUrls": [
    { "url": "https://blog.apify.com/what-is-web-scraping/" },
    { "url": "https://en.wikipedia.org/wiki/Web_scraping" }
  ],
  "maxItems": 5
}
```

### 🧩 Input

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `startUrls` | array | yes | — | Web pages to extract. Each must be an absolute http(s) URL. Pages are fetched exactly as listed; no links are followed. |
| `maxItems` | integer | yes | `5` | Maximum number of pages to extract in this run. |
| `removeElementsCssSelector` | string | no | `null` | Extra CSS selector for elements to strip before extraction, added to the built-in list. Use it to remove site-specific clutter. |
| `minTextLength` | integer | no | `200` | Pages whose extracted text is shorter than this many characters are skipped. Filters out consent walls and redirect stubs. |
| `saveHtml` | boolean | no | `false` | Include the cleaned HTML of the main content in the output. |
| `proxyConfiguration` | object | no | `{ "useApifyProxy": false }` | Proxy settings. Most pages need no proxy. |

### 📤 Output

Each extracted page becomes one dataset item. `markdown` preserves headings, lists, and links, which suits LLM prompts and RAG chunking, while `text` is plain prose for search indexes and hashing. Metadata is read from the page's structured data first and falls back to OpenGraph and standard meta tags, so `publishedAt` is populated for most news and blog pages. Fields that a page does not provide are returned as `null` rather than omitted, keeping the shape consistent across sources.

#### Fields

| Field | Type | Description |
|---|---|---|
| `url` | string | The URL that was fetched, after any redirects. |
| `canonicalUrl` | string | The page's canonical URL, normalised and stripped of tracking parameters. |
| `title` | string | Article title. |
| `description` | string | Short summary or excerpt. |
| `markdown` | string | Main content converted to markdown. |
| `text` | string | Main content as plain text. |
| `html` | string | Cleaned HTML of the main content. `null` unless `saveHtml` is enabled. |
| `author` | string | Article author. |
| `siteName` | string | Publication or site name. |
| `publishedAt` | string | Publication date, ISO 8601. |
| `modifiedAt` | string | Last modification date, ISO 8601. |
| `lang` | string | Page language code. |
| `wordCount` | number | Number of words in `text`. |
| `fetchedAt` | string | When the page was fetched, ISO 8601. |

<details><summary>Example output</summary>

```json
{
  "url": "https://blog.apify.com/what-is-web-scraping/",
  "canonicalUrl": "https://blog.apify.com/what-is-web-scraping",
  "title": "What is web scraping?",
  "description": "An introduction to web scraping and how it works.",
  "markdown": "## What is web scraping?\n\nWeb scraping is the process of...",
  "text": "What is web scraping? Web scraping is the process of...",
  "html": null,
  "author": "Apify",
  "siteName": "Apify Blog",
  "publishedAt": "2024-03-12T09:00:00.000Z",
  "modifiedAt": "2024-06-02T11:20:00.000Z",
  "lang": "en",
  "wordCount": 1420,
  "fetchedAt": "2026-07-24T10:15:30.000Z"
}
```

</details>

### 💡 Use cases

- Feed clean article text into LLM prompts, RAG pipelines, and vector databases.
- Monitor pages for meaningful content changes without being triggered by banner or navigation edits.
- Build a research archive of articles with consistent titles, authors, and publication dates.
- Convert press releases and blog posts to markdown for summarisation or newsletters.
- Enrich a list of search results with the full text behind each link.

### ❓ FAQ

- **Does it follow links on the page?** No. It fetches exactly the URLs you supply, which keeps runs predictable and cheap.
- **Do I need a proxy?** Usually not. Enable one only if a specific site blocks the default requests.
- **What happens if a page has no article?** It is skipped with a warning rather than returning empty text. Adjust `minTextLength` to change the threshold.
- **Will the same page always return the same text?** Yes, provided the article itself has not changed. Boilerplate is removed before extraction, so navigation and footer edits do not alter the result.
- **Does it render JavaScript?** No. It uses fast HTTP requests, which covers articles, blogs, press releases, and news. Pages that build their content entirely in the browser are not supported.

### 🔗 More scrapers by Anyx

- [Google AI Scraper](https://apify.com/anyxsolutions/google-ai-scraper)
- [Indeed Scraper](https://apify.com/anyxsolutions/indeed-scraper)
- [Glassdoor Scraper](https://apify.com/anyxsolutions/glassdoor-scraper)
- [Similarweb Top Websites Scraper](https://apify.com/anyxsolutions/similarweb-top-websites-scraper)

### 🤝 Anyx Solutions

We build custom scrapers and data-extraction pipelines.

- Email: tantosthor@gmail.com

Image credit: [en.wikipedia.org](https://en.wikipedia.org/wiki/Web_scraping)

# Actor input Schema

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

Web pages to extract. Each URL must be an absolute http(s) address. Pages are fetched exactly as listed; no links are followed.

## `maxItems` (type: `integer`):

Maximum number of pages to extract in this run.

## `removeElementsCssSelector` (type: `string`):

Extra CSS selector for elements to strip before extraction, added to the built-in list of navigation, footer, and cookie-banner elements. Use it to remove site-specific clutter.

## `minTextLength` (type: `integer`):

Pages whose extracted text is shorter than this many characters are skipped. Filters out consent walls and redirect stubs.

## `saveHtml` (type: `boolean`):

Include the cleaned HTML of the main content in the output. Increases dataset size.

## `proxyConfiguration` (type: `object`):

Apify proxy settings used for the run.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://blog.apify.com/what-is-web-scraping/"
    },
    {
      "url": "https://en.wikipedia.org/wiki/Web_scraping"
    }
  ],
  "maxItems": 5,
  "removeElementsCssSelector": ".related-posts, .promo",
  "minTextLength": 200,
  "saveHtml": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# 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": [
        {
            "url": "https://blog.apify.com/what-is-web-scraping/"
        },
        {
            "url": "https://en.wikipedia.org/wiki/Web_scraping"
        }
    ],
    "removeElementsCssSelector": ".related-posts, .promo"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ayen-data/web-content-scraper").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": [
        { "url": "https://blog.apify.com/what-is-web-scraping/" },
        { "url": "https://en.wikipedia.org/wiki/Web_scraping" },
    ],
    "removeElementsCssSelector": ".related-posts, .promo",
}

# Run the Actor and wait for it to finish
run = client.actor("ayen-data/web-content-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    {
      "url": "https://blog.apify.com/what-is-web-scraping/"
    },
    {
      "url": "https://en.wikipedia.org/wiki/Web_scraping"
    }
  ],
  "removeElementsCssSelector": ".related-posts, .promo"
}' |
apify call ayen-data/web-content-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=ayen-data/web-content-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/Oac0hQRkyFBQizTqJ/builds/ChXDYLeexLrw7reDy/openapi.json
