# OpenGraph & Link Preview Scraper (`receptional_blender/opengraph-link-preview-scraper`) Actor

Give it any list of URLs and get back the link-preview metadata each page exposes — OpenGraph and Twitter Card tags, title, description, preview image, favicon, canonical URL, site name and type — as clean JSON. Perfect for building rich link previews. No login required.

- **URL**: https://apify.com/receptional\_blender/opengraph-link-preview-scraper.md
- **Developed by:** [Assia Fadli](https://apify.com/receptional_blender) (community)
- **Categories:** Marketing
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

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

## OpenGraph & Link Preview Scraper

Give it any list of URLs and get back the **link-preview metadata** each page exposes — the same tags Slack, Discord, iMessage, WhatsApp and Twitter read when they render a rich preview card.

For every URL the actor fetches the page, reads its `<head>`, and returns one flat JSON row with the **OpenGraph** and **Twitter Card** tags, the title, description, preview image, favicon, canonical URL, site name and more. There is nothing to configure — no API key and no login.

### Features

- Reads **OpenGraph** (`og:*`) tags first, then falls back to standard `<meta>` and **Twitter Card** (`twitter:*`) equivalents.
- Follows redirects and reports the **final URL** it landed on.
- Resolves relative image, favicon and canonical URLs to **absolute** URLs.
- Fetches pages concurrently in small batches to stay fast and polite.
- Uses a realistic browser fingerprint (via `got-scraping`) so pages that block plain HTTP clients still resolve.
- Skips gracefully over unreachable pages — they are recorded with an `error` field so a single bad URL never stops the run.

### Input

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `urls` | array | — | The page URLs to extract link-preview metadata from. |
| `maxItems` | integer | `100` | Maximum number of URLs to scrape. |

#### Example input

```json
{
  "urls": ["https://github.com", "https://www.bbc.com/news"],
  "maxItems": 100
}
```

### Output

Each dataset record looks like this:

```json
{
  "url": "https://github.com",
  "finalUrl": "https://github.com/",
  "title": "GitHub · Build and ship software on a single, collaborative platform",
  "description": "Join the world's most widely adopted, AI-powered developer platform…",
  "image": "https://github.githubassets.com/assets/campaign-social.png",
  "siteName": "GitHub",
  "type": "object",
  "locale": "en",
  "twitterCard": "summary_large_image",
  "twitterSite": "@github",
  "canonicalUrl": "https://github.com/",
  "favicon": "https://github.com/favicon.ico",
  "themeColor": "#1e2327"
}
```

| Field | Description |
| --- | --- |
| `url` | The URL exactly as requested. |
| `finalUrl` | The URL after following any redirects. |
| `title` | `og:title`, else the `<title>` text, else `twitter:title`. |
| `description` | `og:description`, else `<meta name="description">`, else `twitter:description`. |
| `image` | `og:image` (else `twitter:image`), resolved to an absolute URL. |
| `siteName` | `og:site_name`. |
| `type` | `og:type` (e.g. `website`, `article`). |
| `locale` | `og:locale`. |
| `twitterCard` | `twitter:card`. |
| `twitterSite` | `twitter:site`. |
| `canonicalUrl` | `<link rel="canonical">`, resolved absolute. |
| `favicon` | Best `<link rel="icon">`, resolved absolute (falls back to `<origin>/favicon.ico`). |
| `themeColor` | `<meta name="theme-color">`. |

Every metadata field is nullable — most pages only expose a subset of these tags.

If a URL can't be fetched (e.g. it times out or returns a non-2xx status), the row is `{ "url": "<url>", "error": "<message>" }` instead.

### Pricing

This actor uses the **pay-per-event** model: you are charged once per link that is successfully fetched and parsed (the `link-scraped` event). URLs that fail to fetch produce an error row and are never charged.

### License

MIT © Assia Fadli

# Actor input Schema

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

The page URLs to extract link-preview metadata from.

## `maxItems` (type: `integer`):

Maximum number of URLs to scrape.

## Actor input object example

```json
{
  "urls": [
    "https://github.com",
    "https://www.bbc.com/news"
  ],
  "maxItems": 100
}
```

# 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 = {
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("receptional_blender/opengraph-link-preview-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 = { "maxItems": 100 }

# Run the Actor and wait for it to finish
run = client.actor("receptional_blender/opengraph-link-preview-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "maxItems": 100
}' |
apify call receptional_blender/opengraph-link-preview-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=receptional_blender/opengraph-link-preview-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/MeBWaacb2mcdWZU7p/builds/Wk267C45a1nEDzhaY/openapi.json
