# ✨ WordPress Content Extractor (`ramman/wordpress-content-extractor`) Actor

🔍Easily scrape and export posts, pages, metadata, images, and comments from any WordPress site. ✨ WordPress content to JSON, CSV, or TXT — instantly.

- **URL**: https://apify.com/ramman/wordpress-content-extractor.md
- **Developed by:** [ramman](https://apify.com/ramman) (community)
- **Categories:** Automation, Open source
- **Stats:** 45 total users, 3 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $2.30 / 1,000 results

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/actors/running/actors-in-store.md#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

A powerful Apify Actor designed to extract comprehensive content from WordPress websites. This actor automatically discovers and extracts posts, pages, metadata, media, and other WordPress-specific content using intelligent parsing and WordPress REST API integration.

### 🚀 Features

#### **Comprehensive Content Extraction**

- **Blog Posts** - Extract all blog posts with full content, titles, and metadata
- **Static Pages** - Extract WordPress pages and custom post types
- **Media Assets** - Extract images, videos, and other media with alt text
- **SEO Metadata** - Extract meta descriptions, Open Graph tags, and Twitter cards
- **Comments** - Optional extraction of user comments and discussions
- **Taxonomies** - Extract categories, tags, and custom taxonomies
- **Author Information** - Extract post/page author details
- **Publication Dates** - Extract publication and modification timestamps

#### **Smart Discovery**

- **Automatic URL Discovery** - Finds posts and pages through navigation menus
- **WordPress REST API Integration** - Leverages `/wp-json/wp/v2/` endpoints when available
- **Pagination Support** - Automatically follows pagination links
- **Category & Tag Pages** - Discovers content through WordPress taxonomies

#### **Advanced Configuration**

- **Selective Extraction** - Choose what content types to extract
- **Page Limits** - Set maximum number of pages to process
- **SSL Support** - Handles sites with certificate issues
- **Custom Headers** - Uses realistic browser headers for better compatibility

### 📊 Extracted Data Structure

Each extracted page/post includes:

```json
{
  "url": "https://example.com/post-title",
  "title": "Post Title",
  "content": "Full HTML content or text",
  "excerpt": "Post excerpt/summary",
  "metadata": {
    "description": "Meta description",
    "keywords": "Meta keywords",
    "ogTitle": "Open Graph title",
    "ogDescription": "Open Graph description",
    "ogImage": "Open Graph image URL",
    "canonical": "Canonical URL"
  },
  "media": [
    {
      "src": "image-url.jpg",
      "alt": "Image alt text",
      "type": "image"
    }
  ],
  "comments": [
    {
      "author": "Commenter Name",
      "content": "Comment text",
      "date": "Comment date"
    }
  ],
  "publishedDate": "2024-01-01T00:00:00Z",
  "author": "Post Author",
  "categories": ["Category 1", "Category 2"],
  "tags": ["tag1", "tag2"],
  "type": "post"
}
```

### ⚙️ Input Configuration

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `url` | String | Required | WordPress website URL to extract from |
| `extractPosts` | Boolean | `true` | Whether to extract blog posts |
| `extractPages` | Boolean | `true` | Whether to extract static pages |
| `extractMedia` | Boolean | `true` | Whether to extract media URLs |
| `extractMetadata` | Boolean | `true` | Whether to extract SEO metadata |
| `maxPages` | Integer | `0` | Maximum pages to extract (0 = no limit) |
| `includeComments` | Boolean | `false` | Whether to extract comments |

### 🛠️ Technical Details

#### **Built With**

- **[Apify SDK](https://docs.apify.com/sdk/js/)** - Core actor framework
- **[Axios](https://axios-http.com/docs/intro)** - HTTP client with SSL support
- **[Cheerio](https://cheerio.js.org/)** - Fast HTML parsing and manipulation
- **Node.js** - Runtime environment

#### **WordPress Compatibility**

- **All WordPress versions** - Works with any WordPress site
- **Custom themes** - Adapts to different theme structures
- **Gutenberg blocks** - Supports modern WordPress block editor
- **Custom post types** - Extracts custom content types
- **Multisite networks** - Works with WordPress multisite installations

#### **Performance Features**

- **Concurrent processing** - Efficient parallel content extraction
- **Respectful crawling** - Built-in delays to avoid overwhelming servers
- **Error handling** - Robust error recovery and logging
- **Memory efficient** - Optimized for large-scale extraction

### 🚀 Getting Started

#### **Quick Start**

1. **Deploy the Actor** - Build and deploy on Apify Platform
2. **Configure Input** - Set your WordPress website URL
3. **Run Extraction** - Start the actor and monitor progress
4. **Download Results** - Get extracted data in JSON, CSV, or other formats

#### **Example Usage**

```javascript
// Input configuration
{
  "url": "https://your-wordpress-site.com/",
  "extractPosts": true,
  "extractPages": true,
  "extractMedia": true,
  "extractMetadata": true,
  "maxPages": 50,
  "includeComments": false
}
```

### 📈 Use Cases

#### **Content Migration**

- **Site Migration** - Extract content for moving to new platforms
- **Backup Creation** - Create comprehensive content backups
- **Platform Migration** - Move from WordPress to other CMS platforms

#### **Content Analysis**

- **SEO Audit** - Analyze meta tags and content structure
- **Content Inventory** - Catalog all posts, pages, and media
- **Performance Analysis** - Analyze content patterns and structure

#### **Data Integration**

- **API Development** - Create APIs from WordPress content
- **Analytics Integration** - Feed content data to analytics platforms
- **Content Syndication** - Distribute content to multiple platforms

# Actor input Schema

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

The URL of the WordPress website to extract content from

## `extractPosts` (type: `boolean`):

Whether to extract blog posts

## `extractPages` (type: `boolean`):

Whether to extract static pages

## `extractMedia` (type: `boolean`):

Whether to extract media URLs (images, videos)

## `extractMetadata` (type: `boolean`):

Whether to extract SEO metadata and Open Graph data

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

Maximum number of pages to extract (0 = no limit)

## `includeComments` (type: `boolean`):

Whether to extract comments from posts

## `postContainerSelector` (type: `string`):

CSS selector for post containers (e.g., '.post', 'article')

## `titleSelector` (type: `string`):

CSS selector for post/page titles

## `contentSelector` (type: `string`):

CSS selector for post/page content

## Actor input object example

```json
{
  "url": "https://example-wordpress-site.com/",
  "extractPosts": true,
  "extractPages": true,
  "extractMedia": true,
  "extractMetadata": true,
  "maxPages": 0,
  "includeComments": false,
  "postContainerSelector": "article, .post, .entry",
  "titleSelector": "h1, .entry-title, .post-title",
  "contentSelector": ".entry-content, .post-content, .content"
}
```

# 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 = {
    "url": "https://example-wordpress-site.com/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ramman/wordpress-content-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 = { "url": "https://example-wordpress-site.com/" }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ramman/wordpress-content-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/zeAYjlzeyFior6aOD/builds/Xz6j0ZlcsG0ksudfd/openapi.json
