# Article Scraper - Extract Titles, Authors, Tags & Metadata (`cardinal_radiance_bce/article-scraper`) Actor

Extract article titles, dates, authors, tags, reading time, canonical URL and og:image from any webpage, or a whole list of URLs in one batch run. Structured JSON output for RAG, lead generation and content monitoring.

- **URL**: https://apify.com/cardinal_radiance_bce/article-scraper.md
- **Developed by:** [Tristan Evans](https://apify.com/cardinal_radiance_bce) (community)
- **Categories:** Business, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 per scraped articles

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/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 - Extract Titles, Authors, Tags & Metadata

### What It Does

The Article Scraper extracts structured article data from any webpage. It fetches the page, parses HTML with BeautifulSoup, and returns clean JSON with titles, dates, summaries, authors, tags, reading time, canonical URLs, Open Graph images, and full article content in both HTML and Markdown formats. The output is designed for RAG pipelines, lead generation, content monitoring, and AI training data collection.

**Key capabilities:**

- Article metadata extraction (title, date, summary, author, tags, reading time)
- Canonical URL and Open Graph image (og:image) resolution
- Full-text content extraction in HTML and Markdown
- RSS/Atom feed auto-discovery fallback
- Pagination support for multi-page articles and listing pages
- JSON-LD structured data parsing with @graph support
- Dry-run mode for testing without charges

### Features

| Feature | Description |
|---------|-------------|
| **Metadata extraction** | Author, tags, reading time, canonical URL, og:image, site name, locale |
| **Full-text content** | Complete article body in HTML and Markdown (RAG-ready) |
| **Structured data parsing** | JSON-LD (Article, NewsArticle, BlogPosting) with @graph array support |
| **CTA / affiliate links** | Per-article `cta` list of buy/sign-up/affiliate links with the text and why each was flagged |
| **Feed discovery** | Auto-finds RSS/Atom feeds when article elements are not found |
| **Pagination** | Follows `rel="next"`, "Load more" links, and numeric pagination |
| **Dry-run mode** | Test extraction without consuming compute or triggering charges |
| **Resilient fetching** | Browser UA, retry on 429/5xx, fail-fast on permanent 4xx |
| **Clean output** | Deduplication, empty-summary filtering, pay-per-event safety gate |

### How It Works

1. **Input validation** — Accepts a single URL or array of URLs, optional `maxItems`, `includeMetadata`, `dryRun`, and custom `userAgent`.
2. **Fetch with retries** — GET request with browser User-Agent, exponential backoff on 429/500/502/503/504, immediate failure on 404/400/401/403.
3. **Parse HTML** — BeautifulSoup parses the document; article candidates found via semantic selectors (`<article>`, `[role="article"]`, `.post`, `.entry`, etc.).
4. **Extract per article** — Title from `<h1>`/`og:title`, date from `time`/`article:published_time`, summary from meta description or first paragraph.
5. **Enrich with metadata** (if `includeMetadata=true`) — Scans page-level meta tags, Open Graph, Twitter Cards, and JSON-LD for author, tags, reading time, canonical URL, og:image, site name, locale.
6. **Full-text extraction** — Removes nav, footer, aside, script, style; returns cleaned HTML and Markdown via `html2text`.
7. **Feed fallback** — If no articles found, discovers RSS/Atom links in `<head>` and parses feed items.
8. **Pagination** — Detects next-page links and continues until `maxItems` or no more pages.
9. **Clean & dedupe** — Drops items with blank summaries, deduplicates on (title, URL), enforces `maxItems`.
10. **Charge gate** — In dry-run, returns results without pushing. In production, pushes each item with `Actor.push_data(item, charged_event_name="result-item")`.

### Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `urls` | string | string\[] | Yes | — | Single URL or array of URLs to scrape |
| `maxItems` | integer | No | 50 | Maximum articles to return across all URLs |
| `includeMetadata` | boolean | No | true | Extract author, tags, reading_time, canonical_url, og_image, site_name, locale |
| `dryRun` | boolean | No | false | Run extraction without pushing to dataset or charging |
| `userAgent` | string | No | Chrome 125 UA | Custom User-Agent header for requests |

**Example input:**

```json
{
  "urls": ["https://example.com/blog"],
  "maxItems": 20,
  "includeMetadata": true,
  "dryRun": false
}
```

### Output Example

Each dataset item contains:

```json
{
  "title": "How to Build a Scraper in 2024",
  "url": "https://example.com/blog/how-to-build-scraper",
  "date": "2024-01-15T10:30:00Z",
  "summary": "A step-by-step guide to building robust web scrapers...",
  "author": "Jane Developer",
  "tags": ["web scraping", "python", "automation"],
  "reading_time": 8,
  "canonical_url": "https://example.com/blog/how-to-build-scraper",
  "og_image": "https://example.com/images/scraper-guide.jpg",
  "site_name": "Example Blog",
  "locale": "en_US",
  "content": "<article>...full HTML...</article>",
  "markdown": "# How to Build a Scraper in 2024\n\nA step-by-step guide...",
  "cta": [
    {
      "text": "Try the tool free",
      "url": "https://example.com/signup?ref=author",
      "reason": "affiliate-param"
    }
  ]
}
```

`cta[].reason` is one of `affiliate-host` (link points at a known affiliate network such as an Amazon or Awin host), `affiliate-param` (the URL carries an affiliate/tracking parameter such as `ref`, `aff`, `tag` or `partner`), or `button-text` (the visible text reads like a call to action: buy, sign up, try free, join). It is a heuristic: bare "here" links and JS-only buttons are missed by design.

`cta` is always populated (no extra input flag) and the per-article price is unchanged.

### Example output

#### Example output (fields returned in the dataset — 3 articles from github.blog, max 3 results)

| title | date | reading_time | site_name | url |
|---|---|---|---|---|
| Beyond code generation: A developer’s guide to agentic engineering | 2026-11-06 | 1 | The GitHub Blog | https://github.blog/ai-and-ml/github-copilot/beyond-code-generation-a-developers-guide-to-agentic-engineering/ |
| GitHub availability report: October 2026 | 2026-11-12 | 1 | The GitHub Blog | https://github.blog/news-insights/company-news/github-availability-report-october-2026/ |
| Git security vulnerabilities announced | 2026-11-10 | 1 | The GitHub Blog | https://github.blog/open-source/git/git-security-vulnerabilities-announced-7/ |

*Data from a real run on 2026-11-18 (run `A50Avlsqh1kf83lVh`, build `0.0.5`) scraping `github.blog` — dataset `pMshf3Bi02QsHZeiJ`.*

### Cost Estimate

- **Actor start**: $0.001 per run
- **Per article (result-item)**: $0.002 per cleaned article pushed to dataset
- **Apify platform compute**: ~$0.0004–$0.001 per run (depends on memory/CPU seconds)

**Typical run** (1 URL, ~20 articles): ~$0.041 + compute ≈ **$0.05 total**\
**1,000 articles**: ~$2.00 + compute ≈ **$2.50 total**

Free Apify plan runs do not generate revenue for the actor owner. Revenue only accrues from paid-plan users.

#### Price comparison

| Actor | Per article | Per 1,000 articles | Notes |
|---|---|---|---|
| **Article Scraper** | ~$0.002 | **$2.00** | Dry runs free, HTML + Markdown output |
| apify/article-scraper | ~$0.003 | $3.00 | 1,200+ users/30d |
| web-scraper-tools/article-extractor | ~$0.004 | $4.00 | No metadata extraction |

### Limitations

- **JavaScript-rendered content**: This actor uses `requests` + BeautifulSoup (static HTML only). Pages requiring JS execution (React, Vue, infinite scroll) will return incomplete data.
- **Anti-bot protection**: Cloudflare, Akamai, and similar WAFs may block or challenge requests. The actor does not solve CAPTCHAs or rotate proxies.
- **Rate limits**: Target sites may rate-limit or block aggressive scraping. Use responsibly and respect `robots.txt`.
- **Selectors are heuristic**: Article detection works on common patterns but may miss unusual markup. Custom selectors are not supported.
- **No authentication**: Cannot access paywalled or login-required content.
- **Memory limit**: Default 256 MB; large pages or many pagination steps may hit memory ceiling.

### FAQ

**Q: Why is my run returning 0 articles?**\
A: The page may use JavaScript rendering, have anti-bot protection, or use non-standard markup. Try the URL in dry-run mode and check the diagnostic logs.

**Q: Can I scrape a list of article URLs directly?**\
A: Yes, pass an array of article URLs in `urls`. The actor will fetch and extract each one.

**Q: Does it follow pagination automatically?**\
A: Yes, it detects `rel="next"`, "Load more" buttons, and numeric pagination links. Set `maxItems` to control depth.

**Q: What's the difference between `content` and `markdown`?**\
A: `content` is cleaned HTML (scripts/styles/nav removed). `markdown` is the same content converted to Markdown via `html2text` for RAG/LLM ingestion.

**Q: How are charges calculated?**\
A: One `apify-actor-start` ($0.001) per run + one `result-item` ($0.002) per article with a non-empty summary pushed to the dataset. Dry-run mode incurs zero charges.

**Q: Can I use this for product/price scraping?**\
A: This actor is optimized for articles/blogs. For product data, use a dedicated e-commerce scraper with price/currency/availability selectors.

**Q: Can I find affiliate or buy-now links in the articles?**\
A: Yes. Every article item carries a `cta` list of flagged call-to-action links with their visible text, absolute URL and the reason it was flagged. Use it for affiliate-link audits, competitor offer monitoring and outreach lists. It is heuristic, not a guarantee of completeness.

**Q: Is there a free trial?**\
A: Apify offers a free plan with $5/month platform credits. Actor runs on the free plan do not generate revenue for the actor owner.

### Also see

- [workday-jobs-api](https://apify.com/cardinal_radiance_bce/workday-jobs-api) — every job from any Workday career site ($1/1k jobs)
- [career-site-jobs](https://apify.com/cardinal_radiance_bce/career-site-jobs) — Greenhouse, Lever, Ashby, Workable, SmartRecruiters, Recruitee ($3/1k jobs)
- [website-contact-extractor](https://apify.com/cardinal_radiance_bce/website-contact-extractor) — business emails, phones and socials per domain ($1.50/1k sites)
- [uk-food-hygiene-ratings](https://apify.com/cardinal_radiance_bce/uk-food-hygiene-ratings) — UK food business hygiene ratings from the FSA open data ($0.003/record, first 50 free)
- [bulk-domain-check](https://apify.com/cardinal_radiance_bce/bulk-domain-check) — domain availability, RDAP, DNS and SPF/DMARC in bulk ($1/1k domains)

### Local Development

```bash
pip install -r requirements.txt
python -m pytest test_fixture.py -q     # offline fixture suite (66 tests)
python main.py                          # reads storage/key_value_stores/default/INPUT.json
```

# Actor input Schema

## `url` (type: `string`):

URL of the page to scrape for articles. Ignored when 'urls' is filled in — use this for a single page, 'urls' for a list.

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

List of page URLs to scrape in one run. Takes precedence over 'Target URL'. Results from all pages are merged, de-duplicated and capped by Max Results; each extracted article is billed once.

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

Maximum number of articles to extract total (across all pages)

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

Maximum number of pages to scrape (follow pagination links)

## `userAgent` (type: `string`):

Optional User-Agent header override. Leave empty to use the built-in desktop browser User-Agent.

## `dryRun` (type: `boolean`):

Extract and report how many results the URL yields, but push nothing to the dataset and incur no pay-per-event charges. Useful for sizing a scrape before paying for it.

## `includeMetadata` (type: `boolean`):

Extract additional structured metadata per article (author, tags, reading time, canonical URL, og:image). Zero extra network calls — all pulled from the same page HTML.

## `previousResultsDatasetId` (type: `string`):

If provided, the actor marks is_price_changed/price_diff as 'unknown' to signal that a separate dataset comparison is needed (dataset-to-dataset diff logic is not yet implemented; no comparison is performed).

## `mock_html` (type: `string`):

Raw HTML to parse instead of fetching a live URL. Lets the actor run offline with no APIFY_TOKEN and no network calls — useful for testing and CI. Ignored when fetching live pages.

## Actor input object example

```json
{
  "urls": [
    "https://blog.python.org/"
  ],
  "maxResults": 100,
  "maxPages": 1,
  "userAgent": "",
  "dryRun": false,
  "includeMetadata": true,
  "mock_html": ""
}
```

# Actor output Schema

## `articles` (type: `string`):

All extracted articles (title, date, author, tags, reading time, canonical URL, og:image, content and more).

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

The articles in the Overview table view.

# 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://blog.python.org/"
    ],
    "userAgent": "",
    "mock_html": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("cardinal_radiance_bce/article-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://blog.python.org/"],
    "userAgent": "",
    "mock_html": "",
}

# Run the Actor and wait for it to finish
run = client.actor("cardinal_radiance_bce/article-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://blog.python.org/"
  ],
  "userAgent": "",
  "mock_html": ""
}' |
apify call cardinal_radiance_bce/article-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,cardinal_radiance_bce/article-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/ZfSEwYlR92SOVVIYo/builds/T8gWieT0Ta0UQH92y/openapi.json
