# oEmbed Discovery & Response Auditor (`phoenix2810/oembed-discovery-auditor`) Actor

Audits a public page's oEmbed discovery link and endpoint response against the oEmbed 1.0 spec. Validates link rel=alternate discovery, required type/version fields per declared type, and HTTPS.

- **URL**: https://apify.com/phoenix2810/oembed-discovery-auditor.md
- **Developed by:** [Sanskar Jaiswal](https://apify.com/phoenix2810) (community)
- **Categories:** Developer tools, SEO tools
- **Security:** 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

## oEmbed Discovery & Response Auditor

Audits a public page for oEmbed discovery and validates the discovered endpoint response against the [oEmbed 1.0 specification](https://oembed.com/). oEmbed lets a site embed rich representations of other sites' content (photos, videos, and rich HTML widgets) by auto-discovering a provider endpoint through a `<link rel="alternate">` tag and fetching a small structured JSON (or XML) response.

### Use cases

- CMS, blogging platform, and link-preview engineering teams verifying their own oEmbed discovery and endpoint are spec-conformant before launch or after a template change.
- Embedding-client and widget developers validating third-party oEmbed providers before integrating them.
- SEO and content-tooling consultants auditing a client's social/embed readiness as part of a broader technical audit.
- CI/CD pipelines validating `/.well-known`-adjacent oEmbed discovery after reverse-proxy, CMS, or template changes.

### Input

| Field | Type | Required | Description |
|---|---|---|---|
| `startUrl` | string | yes | Public page URL to audit for oEmbed discovery links, e.g. a blog post or media page. |
| `endpointOverride` | string | no | If set, skip HTML discovery and directly validate this oEmbed endpoint URL instead. |
| `timeoutSeconds` | integer | no | Request timeout, 3-30 seconds. Default `10`. |
| `maxResponseBytes` | integer | no | Max bytes read from the page HTML and the oEmbed response body. Default `1000000` (1 MB). |

### Output

One JSON object per run, pushed to the default dataset.

| Field | Type | Description |
|---|---|---|
| `inputUrl` | string | The page URL provided as input. |
| `pageFinalUrl` | string|null | Final page URL after redirects (`null` if `endpointOverride` was used). |
| `discoveryLinks` | array | Discovered `<link rel="alternate">` oEmbed tags: `type`, `href`, `resolvedUrl`, `title`. |
| `endpointTested` | boolean | Whether an oEmbed endpoint URL was found (or supplied) and tested. |
| `endpointUrl` | string|null | The oEmbed endpoint URL that was tested. |
| `endpointStatus` | integer|null | HTTP status code returned by the endpoint. |
| `endpointHttps` | boolean | Whether the endpoint was served over HTTPS. |
| `endpointContentType` | string|null | `Content-Type` header returned by the endpoint. |
| `isXmlResponse` | boolean | Whether the response was the XML oEmbed format rather than JSON. |
| `jsonValid` | boolean | Whether the JSON response body parsed successfully. |
| `oembedType` | string|null | Declared `type` member: `photo`, `video`, `link`, or `rich`. |
| `oembedVersion` | string|null | Declared `version` member. |
| `fieldValidationIssues` | array | Spec violations found in the response fields. |
| `checks` | array | Per-check breakdown: `name`, `status`, `note`, `weight`, `recommendation`. |
| `issues` | array | Deduplicated list of all issues found. |
| `score` | integer | Readiness score, 0-100. |
| `grade` | string | Letter grade, `A+` to `F`. |
| `checkedAt` | string | ISO timestamp of the audit. |
| `recommendations` | array | Actionable fixes. |
| `error` | string|null | Top-level page-fetch error, if any. |

### Example input

```json
{
  "startUrl": "https://www.flickr.com/photos/bees/2341623661/",
  "timeoutSeconds": 10
}
```

### Example output

```json
{
  "inputUrl": "https://www.flickr.com/photos/bees/2341623661/",
  "discoveryLinks": [
    {
      "type": "application/json+oembed",
      "href": "https://www.flickr.com/services/oembed/?url=...&format=json",
      "resolvedUrl": "https://www.flickr.com/services/oembed/?url=...&format=json",
      "title": "oEmbed Profile"
    }
  ],
  "endpointTested": true,
  "endpointStatus": 200,
  "endpointHttps": true,
  "endpointContentType": "application/json; charset=utf-8",
  "isXmlResponse": false,
  "jsonValid": true,
  "oembedType": "photo",
  "oembedVersion": "1.0",
  "fieldValidationIssues": [],
  "score": 100,
  "grade": "A+",
  "issues": [],
  "recommendations": ["oEmbed discovery and response look spec-conformant. Re-run this audit after template/provider changes to catch regressions."]
}
```

### What the spec requires

Per the oEmbed 1.0 specification:

- A provider page SHOULD declare discovery via `<link rel="alternate" type="application/json+oembed" href="...">` (and optionally a second link with `type="text/xml+oembed"`) so embedding clients can find the endpoint without hardcoded provider logic.
- The oEmbed endpoint response is a JSON (or XML) object with required `type` (`photo`, `video`, `link`, or `rich`) and `version` (`"1.0"`) members.
- `type: photo` responses require `url`, `width`, and `height`.
- `type: video` and `type: rich` responses require `html`, `width`, and `height`.
- `type: link` responses require only `type` and `version`; other optional members (`title`, `author_name`, `author_url`, `provider_name`, `provider_url`, `cache_age`, `thumbnail_url`, `thumbnail_width`, `thumbnail_height`) MAY be present on any type and must have the documented types when present.

### Security

- Public HTTP/HTTPS only. URL credentials are rejected.
- Localhost and private/link-local IPv4 and IPv6 literal ranges (RFC 1918, RFC 3927, and IPv6 unique-local/link-local equivalents, including bracketed IPv6 literals) are blocked.
- Hostnames are DNS-resolved and resolved addresses are re-checked against the same private-range rules before any request is made (SSRF defense in depth).
- Redirects are manually followed and each hop is revalidated with the same SSRF checks before the next request is made (max 3 hops).
- Response bodies (both the page HTML and the oEmbed endpoint body) are capped at `maxResponseBytes` (default 1 MB).
- Only the audited page and the one discovered (or supplied) oEmbed endpoint URL are ever fetched; no other links found in the page or response are fetched by this actor.
- No login, no credential collection, no private-data extraction.

### Pricing

| Event | Price (USD) |
|---|---|
| Actor start | $0.005 |
| Page audited | $0.01 |

Apify takes a 20% platform commission; the operator keeps 80%.

### FAQ

**What if a page has no oEmbed discovery link at all?** The audit still runs, scores the missing-discovery check as a hard miss, and returns a recommendation to publish a discovery link. No endpoint is tested in that case.

**What if I already know the oEmbed endpoint URL and don't want HTML discovery?** Set `endpointOverride` to the exact endpoint URL (including any `url=` query parameter your provider requires); the actor will skip page discovery and validate that endpoint directly.

**Does this actor support the XML oEmbed format?** It detects XML responses by Content-Type and reports it, but field-level validation (required members per type) is only performed on the JSON format, since JSON is the format recommended by the current spec and used by the overwhelming majority of real-world providers.

**Why does `type: link` score 100 with so few fields?** The oEmbed spec genuinely requires only `type` and `version` for the `link` type; this actor does not penalize spec-compliant minimal responses.

# Actor input Schema

## `startUrl` (type: `string`):

Public page URL to audit for oEmbed discovery links. The actor fetches this page's HTML and looks for <link rel="alternate"> discovery tags. HTTP and HTTPS only. Private IP ranges are blocked.

## `endpointOverride` (type: `string`):

If set, skip HTML discovery and directly validate this oEmbed endpoint URL (should already include the url= query parameter or be a provider base you want tested as-is).

## `timeoutSeconds` (type: `integer`):

Timeout for each HTTP request.

## `maxResponseBytes` (type: `integer`):

Maximum bytes read from the page HTML and the oEmbed response body.

## Actor input object example

```json
{
  "startUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "timeoutSeconds": 10,
  "maxResponseBytes": 1000000
}
```

# 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 = {
    "startUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
};

// Run the Actor and wait for it to finish
const run = await client.actor("phoenix2810/oembed-discovery-auditor").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 = { "startUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }

# Run the Actor and wait for it to finish
run = client.actor("phoenix2810/oembed-discovery-auditor").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 '{
  "startUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}' |
apify call phoenix2810/oembed-discovery-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,phoenix2810/oembed-discovery-auditor"
        }
    }
}
```

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/VOVA3vhGgHkxBpJ6c/builds/ILrEdEyatOQXEut9c/openapi.json
