# URL Metadata & Link Preview Extractor (`toned_orbweaver/url-metadata-extractor`) Actor

For a list of URLs, return title, meta description, Open Graph/Twitter card, canonical, favicon, language, status. Respects robots.txt.

- **URL**: https://apify.com/toned_orbweaver/url-metadata-extractor.md
- **Developed by:** [Bonnie & Tim](https://apify.com/toned_orbweaver) (community)
- **Features:** Limited permissions
- **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

## URL Metadata & Link Preview Extractor

Turn any list of URLs into clean **link-preview data**: page title, meta description, **Open Graph** and **Twitter Card** tags, canonical URL, favicon, language, first heading, HTTP status, and the final URL after redirects. It is fast, plain HTTP with no browser, and it **respects robots.txt** by default.

### What can it do?

- 🏷️ Extract `<title>`, meta description, and the first `<h1>`
- 🖼️ Read Open Graph tags (title, description, image, type, site name) and the Twitter card type
- 🔗 Return the canonical URL, favicon, and final URL after redirects
- 🌐 Detect the page language (`lang`) and HTTP status code
- 🤖 Respect robots.txt, with an option to turn the check off
- ⚡ Fetch many URLs in parallel; failures come back as rows with an `error` message instead of stopping the run

### Who is it for?

- **Developers** building link previews, bookmarking tools, or chat unfurls
- **SEO specialists** auditing titles, descriptions, canonicals, and OG images across many pages
- **Content and social teams** checking how pages will look when shared
- **Data teams** enriching URL lists with titles and descriptions

### How to use it

1. Add one or more URLs to **URLs**. A missing `https://` is added for you.
2. Keep **Respect robots.txt** on (recommended), and adjust **Max concurrency** or **Per-request timeout** if needed.
3. Click **Start**. Each URL becomes one row in the dataset, ready to export as JSON, CSV, or Excel or to pull through the Apify API.

### Input example

```json
{
  "urls": ["https://example.com", "https://www.python.org"],
  "respectRobotsTxt": true,
  "maxConcurrency": 5,
  "timeoutSecs": 20
}
```

### Output example

```json
{
  "url": "https://www.python.org",
  "finalUrl": "https://www.python.org",
  "status": 200,
  "contentType": "text/html; charset=utf-8",
  "title": "Welcome to Python.org",
  "description": "The official home of the Python Programming Language",
  "ogTitle": "Welcome to Python.org",
  "ogDescription": "The official home of the Python Programming Language",
  "ogImage": "https://www.python.org/static/opengraph-icon-200x200.png",
  "ogType": "website",
  "ogSiteName": "Python.org",
  "twitterCard": "",
  "canonical": "",
  "favicon": "https://www.python.org/favicon.ico",
  "lang": "en",
  "h1": "Functions Defined",
  "error": ""
}
```

When a page can't be fetched, the row has an empty `status` and an `error` such as `blocked_by_robots_txt` or `ConnectTimeout`.

### How much does it cost?

The Actor uses 256 MB of memory and no browser or proxy, so hundreds of URLs cost a tiny fraction of a compute unit. See the **Pricing** tab for the current price.

### Limits

- Pages that build their metadata with JavaScript after loading may return fewer fields, since no browser is used.
- Some sites block automated or datacenter traffic. Those URLs come back with a 403 status or an error.
- The Actor does not crawl or follow links. It only fetches the URLs you provide.

### Responsible use

Only submit URLs you're allowed to access. The Actor reads public `<head>` metadata that sites publish for sharing and previews, and it respects robots.txt unless you turn that off, in which case following each site's terms is your responsibility.

### Feedback

Need another tag extracted? Open an issue on the **Issues** tab.

# Actor input Schema

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

Public page URLs to inspect (one per line). URLs without http(s):// get https:// added.

## `respectRobotsTxt` (type: `boolean`):

Skip URLs disallowed by the site robots.txt when true.

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

How many URLs to fetch in parallel.

## `timeoutSecs` (type: `integer`):

Seconds to wait for each page before giving up.

## Actor input object example

```json
{
  "urls": [
    "https://example.com",
    "https://www.python.org"
  ],
  "respectRobotsTxt": true,
  "maxConcurrency": 5,
  "timeoutSecs": 20
}
```

# Actor output Schema

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

Metadata records for each requested URL.

# 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://example.com",
        "https://www.python.org"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("toned_orbweaver/url-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 = { "urls": [
        "https://example.com",
        "https://www.python.org",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("toned_orbweaver/url-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 '{
  "urls": [
    "https://example.com",
    "https://www.python.org"
  ]
}' |
apify call toned_orbweaver/url-metadata-extractor --silent --output-dataset

```

## MCP server setup

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