# Article Scraper - Structured Article Fields from URLs (`tidytools/article-structured-scraper`) Actor

Extract headline, byline, publication date and article text from public article URLs into one structured JSON row per page. Missing fields are null; failed pages are free.

- **URL**: https://apify.com/tidytools/article-structured-scraper.md
- **Developed by:** [Yukai Lin](https://apify.com/tidytools) (community)
- **Categories:** News, AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 extracted pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## 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

## Article Scraper — structured article fields from URLs

### What does it do?

Paste publicly readable article URLs and get one JSON Dataset row per page. The default `data` object asks for `headline`, `byline`, `datePublished`, and `articleText`. Article editors and data teams can export the rows or use the Dataset API. This Actor uses the AI Web Data Extractor engine; it is a URL list to article fields, not news search or a whole-site Markdown crawler.

### How to use

1. Replace the prefilled Wikipedia article URL with public article URLs, one per line.
2. Keep **Fields** for the four article fields, or edit the names and types. Run a small sample and check its evidence before a larger batch.
3. Leave **Output** at one row per page. **Follow links** and **Follow list pages automatically** are off by default, so linked pages do not add unexpected charges.

Advanced options remain available: `startUrls`, `datasetId`/`datasetField`, `instructions`/`prompt`, `preset`, `jsonSchema`, `outputMode`, `flatOutput`, page fetching, pagination, and quality reporting. `jsonSchema` overrides **Fields**. Choosing a `preset` requires clearing the prefilled **Fields** if you want only the preset fields; field overrides are merged and your types win. Turning on link following or pagination can extract and charge additional successful pages.

### Input example

```json
{
  "urls": ["https://en.wikipedia.org/wiki/Cloudflare"],
  "fields": {"headline": "string", "byline": "string", "datePublished": "string", "articleText": "string"},
  "outputMode": "page",
  "followLinks": false,
  "followPagination": false,
  "flatOutput": false
}
```

The prefilled URL is a public example, not a guarantee that the site will allow automated reading at run time.

### Output example

The Dataset overview displays `url`, `title` (page title), `data`, `success`, `charged`, `errorType`, and `error`. The `data` object holds the requested article fields. This illustrative row is the output shape, not a verified run against Wikipedia:

```json
{
  "url": "https://example.org/public-article",
  "title": "Example article",
  "data": {
    "headline": "Example article",
    "byline": null,
    "datePublished": null,
    "articleText": "The article body found on the page."
  },
  "success": true,
  "charged": true
}
```

A missing author or publication date is `null`; neither is guaranteed. The full Dataset JSON can include additional engine diagnostic fields. Failed, blocked, invalid, and empty pages produce free error output with `success: false`, `charged: false`, `errorType`, and `error`.

### Pricing

The existing `page-extracted` event and AI Web Data Extractor price apply: one event per successfully extracted page, currently $0.01 per page on the Free plan. Errors and pages with no usable fields are free. An article URL list of two readable pages creates two events. If you enable link following or pagination, every additional successful page creates another event. No new event or price is introduced by this variant.

### Limitations

Only use publicly readable pages you are allowed to access. The Actor cannot read content behind a login or paywall. Sites may block automated access or return thin or incomplete text. Long pages may be shortened by the fetch or model limits; check important fields against the source. It does not search for news, crawl an entire site by default, or guarantee a byline or date.

### FAQ

**Can I add more fields?** Yes. Edit **Fields** or supply a full `jsonSchema`; a JSON Schema takes priority over **Fields**.

**What if an article has no author or date?** Those requested values are `null` when absent; check the source if they matter.

**Will the Actor visit links on the article?** No, unless you turn on `followLinks` or `followPagination`.

**Are errors billed?** No. Only successful extracted pages create `page-extracted` events.

# Actor input Schema

## `urls` (type: `array`):

Paste publicly readable article URLs, one per line. The Wikipedia URL is a sample; replace it with your articles. Pages behind a login or paywall cannot be read. Invalid URLs return a free error row. You can also use startUrls or a datasetId.

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

Same as "URLs or domains", in Apify's request list format (also accepts a link to a text file with URLs). Kept for existing integrations; new integrations should use "urls".

## `preset` (type: `string`):

Want to skip writing fields? Choose a preset, then clear the sample Fields below. Each preset supplies its columns and row mode; extra Fields are merged and your types win. Directory and catalog presets return one row per visible item. Use pages you own or may access.

## `fields` (type: `object`):

Article fields to extract: {"headline":"string","byline":"string","datePublished":"string","articleText":"string"}. Missing values return null. Edit or add field names and types for other pages; advanced JSON Schema overrides Fields. Clear Fields when choosing a preset or using Instructions alone.

## `instructions` (type: `string`):

Or write one sentence, such as "Get each product's name, price and rating". Clear the sample Fields first if you want the AI to choose columns from this sentence. With no Fields or JSON Schema, it chooses once from the first page, reuses the columns for this run and saves them as SCHEMA. You can also use this for hints such as "Prices in USD".

## `prompt` (type: `string`):

Same as "Instructions"; used only when Instructions is empty. Lets you paste the input JSON of Apify's AI Web Scraper (`startUrls` + `prompt`) and run it unchanged. Its crawl options (extractionMode scout/agentic, maxPagesToVisit, maxCrawlDepth) are ignored: only the start URLs are read, or turn on "Follow links to detail pages".

## `outputMode` (type: `string`):

"One row per page": one data object per URL. "One row per item": for listing pages (products, jobs, search results, team members), every item on the page becomes its own row with url and itemIndex. Still charged per page. Values: page = One row per page; items = One row per item on the page (lists).

## `flatOutput` (type: `boolean`):

Put every extracted field in its own column instead of inside "data". Nested objects become columns joined with \_ (price.amount → price_amount), lists of values become one text cell ("red, blue"), lists of objects become a JSON text cell. Every row has the same columns in the same order, failed pages included (empty values, recordCount 0). recordIndex is the item's position on the page and the page title is in pageTitle. Same number of rows and same price as without it.

## `qualityReport` (type: `boolean`):

Write DATA_QUALITY.json and DATA_QUALITY.csv with field missing counts, type error counts, review suggestions and completeness across saved data rows. Failed or free rows are counted separately. Quality hints are not human verification. No extra AI calls or page-extracted charges.

## `followLinks` (type: `boolean`):

Treat the start URLs as list pages (category, search results, index): read each one for free, then extract data from the pages it links to (e.g. every product page). The start page itself is not extracted. Each extracted page is charged as usual.

## `followPagination` (type: `boolean`):

Extract the starting list page, then follow visible same-domain Next or page-number links. Stops when there is no next link; it does not guess from ?page=N alone. Each successful page is one page-extracted charge, even when Output is one row per item. Default off. Use Max pages to cap charges per starting URL.

## `maxPages` (type: `integer`):

Maximum pages including the starting page for each URL when Follow list pages automatically is on. Default 5; maximum 50. Each successful page is one page-extracted charge.

## `linkPattern` (type: `string`):

Which links to follow. A glob such as https://books.toscrape.com/catalogue/*/index.html (* = any text within one path segment, \*\* = across segments), or plain text the link must contain, such as /product/. Separate several with commas. Empty = every link to the same site (menus included, so a pattern is recommended).

## `maxPagesPerStartUrl` (type: `integer`):

At most this many linked pages are extracted from each start page (in page order). Caps the cost.

## `jsonSchema` (type: `object`):

Optional full JSON Schema (type: object) for nested output. When set, it replaces "Fields". In item mode it describes one item.

## `datasetId` (type: `string`):

Read the URLs from another Actor run's dataset, e.g. a crawler or a search results scraper. Values that are not URLs are extracted from as text.

## `datasetField` (type: `string`):

Field with the URLs, e.g. "url" or "website" (dot paths such as "company.url" work). Empty = the first URL field found.

## `mode` (type: `string`):

"Auto" reads pages over plain HTTP and switches to a real browser when a site blocks it or needs JavaScript. Values: auto = Auto (recommended); fast = Fast (HTTP only); browser = Browser (JavaScript rendering).

## `cssSelector` (type: `string`):

Optional. Only read this part of each page, e.g. "main". Helps with very long pages.

## `maxConcurrency` (type: `integer`):

How many pages are processed at the same time.

## `itemTimeoutSecs` (type: `integer`):

A page that takes longer (reading + AI) is stopped and returned as a free error row with errorType "timeout". In list mode, the items from the parts that finished in time are kept. 0 = no limit.

## `aiModel` (type: `string`):

Same price for every model. Auto uses Llama 3.3 70B for one row per page and Qwen3 30B for list pages (one row per item), where it writes long lists about 3 times faster with the same accuracy in our tests.

## `httpVia` (type: `string`):

Some sites block requests from data centers. Auto retries from a second network before falling back to a real browser. If both are refused, Auto also tries our second server (Oracle, different IP) before a real browser.

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

Only used for requests sent from Apify's network. Apify proxy usage is billed to your Apify account.

## `maxPdfPages` (type: `integer`):

Read up to this many pages per PDF. Only pages with text that are sent to extraction incur one page-extracted event each.

## Actor input object example

```json
{
  "urls": [
    "https://en.wikipedia.org/wiki/Cloudflare"
  ],
  "fields": {
    "headline": "string",
    "byline": "string",
    "datePublished": "string",
    "articleText": "string"
  },
  "outputMode": "page",
  "flatOutput": false,
  "qualityReport": false,
  "followLinks": false,
  "followPagination": false,
  "maxPages": 5,
  "maxPagesPerStartUrl": 20,
  "mode": "auto",
  "maxConcurrency": 5,
  "itemTimeoutSecs": 180,
  "aiModel": "auto",
  "httpVia": "auto",
  "maxPdfPages": 20
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `full` (type: `string`):

No description

## `qualityJson` (type: `string`):

No description

## `qualityCsv` (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 = {
    "urls": [
        "https://en.wikipedia.org/wiki/Cloudflare"
    ],
    "fields": {
        "headline": "string",
        "byline": "string",
        "datePublished": "string",
        "articleText": "string"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidytools/article-structured-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 = {
    "urls": ["https://en.wikipedia.org/wiki/Cloudflare"],
    "fields": {
        "headline": "string",
        "byline": "string",
        "datePublished": "string",
        "articleText": "string",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("tidytools/article-structured-scraper").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 '{
  "urls": [
    "https://en.wikipedia.org/wiki/Cloudflare"
  ],
  "fields": {
    "headline": "string",
    "byline": "string",
    "datePublished": "string",
    "articleText": "string"
  }
}' |
apify call tidytools/article-structured-scraper --silent --output-dataset

```

## MCP server setup

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

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/1qVnNsxc2JI2ZL3WN/builds/iGDZbWHUrrcNOMVkx/openapi.json
