# Website Link Relations to CSV (`datalantern/page-link-relations`) Actor

Export permitted static link relationships, anchor labels, source URLs and duplicate counts without fetching destinations.

- **URL**: https://apify.com/datalantern/page-link-relations.md
- **Developed by:** [Data Lantern](https://apify.com/datalantern) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 1,000 completed source pages

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

## Website Link Relations to CSV

Supply 1–25 authorized final public URLs and set authorized to true for custom URLs. The Actor reads the HTML of each distinct source URL, checks robots and never follows any extracted destination. Each edge has its source, normalized target, internal/external classification, total occurrences, distinct anchor labels and rel values. Internal means the target has exactly the same hostname as the source; subdomains count as external.

Relative links are resolved against the first usable head base URL or the page URL. Target fragments are discarded and repeated targets are grouped; query strings remain part of the target. Fragment-only anchors, private hosts, non-web schemes and credentials are excluded. Text, accessible labels or image alt text can supply an anchor label. Results describe HTML links, not JavaScript navigation, link availability or endorsement.

Download the LINKS_CSV record from the default key-value store (UTF-8 CSV with a header). Each row is one source-target relation. Lists of anchor labels and rel values are encoded as JSON in their cells. Dataset rows group the same edges by source input and retain original inputIndexes. Bounds: 1,500 anchor elements inspected, 300 distinct targets per page, 12 labels and 12 rel entries per target, and a 4 MiB batch CSV. Over-limit/partial pages report a reason and trigger no result event. A page with no eligible links has no result charge. No external assets are downloaded.

Source limits: 64 KiB robots, 256 KiB HTML, 8 seconds per URL. Pay-per-event pricing: $1.50 per 1,000 fully exported source pages, one link-page event per successful source. No start or automatic dataset-item fee proposed.

The prefilled single RFC Editor document (https://www.rfc-editor.org/rfc/rfc2606.html) can be tried directly. This performs a real public page read and a successful result is billable at the listed rate. Any other URL or a mixed list requires an explicit permission confirmation. You can set a lower maximum charge when starting a run.

# Actor input Schema

## `authorized` (type: `boolean`):

Confirm permission for custom URLs. The single prefilled public RFC 2606 demo works without checking this box.

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

1–25 final public HTTP(S) page URLs.

## Actor input object example

```json
{
  "authorized": false,
  "urls": [
    "https://www.rfc-editor.org/rfc/rfc2606.html"
  ]
}
```

# Actor output Schema

## `rows` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `links_csv` (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 = {
    "urls": [
        "https://www.rfc-editor.org/rfc/rfc2606.html"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("datalantern/page-link-relations").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://www.rfc-editor.org/rfc/rfc2606.html"] }

# Run the Actor and wait for it to finish
run = client.actor("datalantern/page-link-relations").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://www.rfc-editor.org/rfc/rfc2606.html"
  ]
}' |
apify call datalantern/page-link-relations --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datalantern/page-link-relations"
        }
    }
}
```

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/xv1dbF9bwKSW8fMce/builds/shWv9EnDjkTClYDre/openapi.json
