# Smart Article Extractor (`muhammadafzal/smart-article-extractor`) Actor

Extract clean article text, metadata, headings, images, word count, and reading time from public web pages for research, search indexing, and AI-agent workflows.

- **URL**: https://apify.com/muhammadafzal/smart-article-extractor.md
- **Developed by:** [Muhammad Afzal](https://apify.com/muhammadafzal) (community)
- **Categories:** MCP servers, Automation, Other
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 article record returneds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## Smart Article Extractor

Extract readable article content and normalized metadata from public web pages. Use it for research pipelines, search indexing, content migration, summarization, retrieval-augmented generation, and AI-agent workflows that need one clean record per URL.

### What it returns

| Field | Description |
|---|---|
| `text` | Clean article text with common navigation, ads, scripts, and boilerplate removed |
| `title`, `description`, `excerpt` | Page title and short summaries |
| `author`, `publishedAt`, `modifiedAt` | Metadata when declared by the source page |
| `canonicalUrl`, `siteName`, `language`, `articleType` | Page identity and content metadata |
| `headings`, `images` | Structured article elements |
| `wordCount`, `readingTimeMinutes` | Content size estimates |
| `extractionMethod`, `warnings` | Transparent diagnostics about selection and missing metadata |

### When to use it

Use this actor when you already have public article URLs and need readable text plus metadata. It is not a search engine, sitemap crawler, PDF parser, browser automation tool, or authenticated/paywall bypass. JavaScript-only pages, login walls, and pages that expose no article content produce a successful diagnostic record with `extractionMethod: "no-content"` when the page can be fetched.

### Input

```json
{
  "startUrls": [
    { "url": "https://example.com/news/article" },
    { "url": "https://example.org/blog/post" }
  ],
  "maxResults": 10,
  "includeHtml": false,
  "responseFormat": "detailed"
}
```

`startUrls` is required and accepts public `http` or `https` URLs. `maxResults` is capped at 100. Set `includeHtml` to true to include cleaned article markup; it is false by default to keep agent responses compact. `responseFormat: "concise"` limits headings and image arrays but does not truncate `text`.

### Output example

```json
{
  "sourceUrl": "https://example.com/news/article",
  "canonicalUrl": "https://example.com/news/article",
  "title": "A practical article title",
  "description": "A short page summary",
  "excerpt": "The first part of the cleaned article...",
  "author": "Jane Doe",
  "publishedAt": "2026-01-15T09:30:00Z",
  "modifiedAt": null,
  "siteName": "Example News",
  "language": "en",
  "articleType": "NewsArticle",
  "text": "The cleaned article body...",
  "html": null,
  "headings": ["Introduction", "Conclusion"],
  "images": ["https://example.com/image.jpg"],
  "wordCount": 842,
  "readingTimeMinutes": 5,
  "extractionMethod": "article-element",
  "warnings": [],
  "extractedAt": "2026-08-13T10:00:00.000Z"
}
```

### Pricing

| Event | Price |
|---|---:|
| Actor start | $0.00005 |
| Article record returned | $0.003 |

You are charged only after an article record is stored. A 10-URL run costs at most $0.030 in record events plus the actor-start event. Invalid URL strings are ignored without a record charge; fetch failures are reported in `OUTPUT`.

### Reliability and limits

The actor uses public HTML requests with bounded retries and concurrency. It prefers an `article` or `main` container, then scores content-like blocks, and finally uses a body fallback. It does not execute page JavaScript or defeat bot challenges. Respect each website's terms, robots directives, copyright, and applicable privacy laws; only process content you are allowed to access and use.

### AI-agent description

Extract clean article text and metadata from public web URLs for research, indexing, summarization, and retrieval workflows. Do not use for search, PDFs, authenticated pages, or paywall bypass. Returns one record per URL with title, author, dates, canonical URL, text, headings, images, word count, reading time, and warnings. Charged $0.003 per article returned plus a $0.00005 start fee.

# Actor input Schema

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

Use this when you have one or more public article pages to extract. Enter full http(s) URLs such as 'https://example.com/news/article'. Defaults to the supplied URLs only and accepts up to 100 pages. NOT a search query, sitemap, or authenticated URL.

## `maxResults` (type: `integer`):

Use this when you need to cap the number of pages processed and the maximum record cost. Enter an integer from 1 to 100; the default is 10 and each returned article costs $0.003. NOT a content length or pagination cursor.

## `includeHtml` (type: `boolean`):

Use this when downstream systems need the cleaned article markup as well as plain text. The default is false to keep agent responses small; set true to return an HTML field. NOT the original page source or JavaScript bundle.

## `responseFormat` (type: `string`):

Use this when an AI agent needs a smaller or fuller record. Choose concise for bounded headings and image lists, or detailed for the full normalized record; detailed is the default. This does not change article text extraction.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://example.com/"
    }
  ],
  "maxResults": 10,
  "includeHtml": false,
  "responseFormat": "detailed"
}
```

# Actor output Schema

## `status` (type: `string`):

SUCCEEDED after the requested URLs were attempted.

## `recordsReturned` (type: `string`):

Number of article records written to the dataset.

## `requestedUrls` (type: `string`):

Number of valid URLs submitted to the crawler.

## `failedRequests` (type: `string`):

URLs that could not be fetched or parsed after retries.

## `chargedRecordEvents` (type: `string`):

Number of article-record events charged after records were stored.

## `spentUsd` (type: `string`):

Article record event spend excluding the actor-start event.

## `warnings` (type: `string`):

Non-fatal input and request diagnostics.

# 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://example.com/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("muhammadafzal/smart-article-extractor").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://example.com/" }] }

# Run the Actor and wait for it to finish
run = client.actor("muhammadafzal/smart-article-extractor").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": [
    {
      "url": "https://example.com/"
    }
  ]
}' |
apify call muhammadafzal/smart-article-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muhammadafzal/smart-article-extractor"
        }
    }
}

```

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/7iTXbGPfIIaB8xk51/builds/0rMldrJ433ijoXaj2/openapi.json
