# Page Metadata Extractor (`tc-mo/page-metadata-extractor`) Actor

Extracts SEO and social metadata (title, description, canonical URL, Open Graph and Twitter Card tags) from any list of web pages.

- **URL**: https://apify.com/tc-mo/page-metadata-extractor.md
- **Developed by:** [Michał Olender](https://apify.com/tc-mo) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

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

## Page Metadata Extractor

Page Metadata Extractor collects SEO and social metadata from any list of web pages. Give it URLs and it returns each page's title, meta description, canonical URL, declared language, and optionally the full set of Open Graph and Twitter Card tags — as a clean, structured dataset.

### What can you use it for?

- *SEO audits* - check that titles, descriptions, and canonical URLs are present and correct across your site.
- *Social preview checks* - verify what a page will look like when shared on social networks.
- *Content inventories* - build a quick metadata catalog of any set of pages.

### Input

| Field | Type | Description |
|---|---|---|
| `startUrls` | array | List of page URLs to process. Required. |
| `includeSocialMeta` | boolean | Also extract Open Graph (`og:*`) and Twitter Card (`twitter:*`) tags. Default: `true`. |
| `maxRequestsPerCrawl` | integer | Safety limit on the number of pages processed in one run. Default: `100`. |

Example input:

```json
{
    "startUrls": [{ "url": "https://apify.com" }],
    "includeSocialMeta": true
}
```

### Output

Each processed page produces one dataset item:

```json
{
    "url": "https://apify.com",
    "title": "Apify: Full-stack web scraping and data extraction platform",
    "description": "Cloud platform for web scraping, browser automation, and data for AI.",
    "canonicalUrl": "https://apify.com",
    "language": "en",
    "openGraph": {
        "og:title": "Apify: Full-stack web scraping and data extraction platform",
        "og:type": "website"
    },
    "twitterCard": {
        "twitter:card": "summary_large_image"
    }
}
```

You can download the results as JSON, CSV, or Excel from the run's **Storage** tab, or fetch them through the [Apify API](https://docs.apify.com/api/v2).

### How it works

The Actor fetches each URL over plain HTTP (no browser), parses the HTML, and reads the metadata straight from the document head. Pages that fail to load are retried and reported in the run log. The Actor runs with limited permissions and only accesses the pages you give it.

# Actor input Schema

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

List of web page URLs to extract metadata from. Each URL is fetched once and its metadata is stored as one dataset item.

## `includeSocialMeta` (type: `boolean`):

If enabled, the Actor also extracts Open Graph (og:*) and Twitter Card (twitter:*) tags in addition to the basic SEO metadata.

## `maxRequestsPerCrawl` (type: `integer`):

Maximum number of pages to process in a single run. Use it as a safety limit when passing long URL lists.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://apify.com"
    },
    {
      "url": "https://docs.apify.com"
    }
  ],
  "includeSocialMeta": true,
  "maxRequestsPerCrawl": 100
}
```

# Actor output Schema

## `results` (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://apify.com"
        },
        {
            "url": "https://docs.apify.com"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tc-mo/page-metadata-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://apify.com" },
        { "url": "https://docs.apify.com" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("tc-mo/page-metadata-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://apify.com"
    },
    {
      "url": "https://docs.apify.com"
    }
  ]
}' |
apify call tc-mo/page-metadata-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tc-mo/page-metadata-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/Bvov12NLQgKRPkLLD/builds/tAA7m7oyfi2KZCLhq/openapi.json
