# Twitter Card Validator (`scrappy_garden/twitter-card-validator`) Actor

Validate Twitter Card meta tags (twitter:card, twitter:title, twitter:description, twitter:image, etc.) to optimize link previews on X (Twitter) and other apps that reuse Twitter card metadata. Detect missing/empty tags, duplicates, invalid URLs, and optionally verify image URL accessibility.

- **URL**: https://apify.com/scrappy\_garden/twitter-card-validator.md
- **Developed by:** [Bikram Adhikari](https://apify.com/scrappy_garden) (community)
- **Categories:** Developer tools
- **Stats:** 4 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.99/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

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

## Twitter Card Validator (twitter:\* meta tags)

Validate Twitter Card meta tags so your URLs generate correct link previews on **X (Twitter)** and other platforms that reuse Twitter card metadata.

This actor extracts all `twitter:*` meta tags, checks for common issues, and outputs both a per-page dataset and a run-level `SUMMARY` + `REPORT`.

### What it checks

- Extracts `meta[name="twitter:..."]` (and `meta[property="twitter:..."]` when present)
- Missing required tags (default: `twitter:card`, `twitter:title`, `twitter:description`, `twitter:image`)
- Empty values (treated as missing)
- Duplicate tags (same `twitter:*` tag repeated)
- Optional: validate `twitter:card` type is one of `summary`, `summary_large_image`, `app`, `player`
- Optional: lightweight HTTP checks that `twitter:image` is accessible and is an image

### Input

- **Start URLs**: list of URLs to check
- **Max pages**: limit pages processed
- **Follow links / Max depth / Same domain only**: depth-limited internal crawl
- **Request timeout**: per-page timeout
- **Required Twitter tags**: override required list
- **Validate twitter:image URLs**: optional image accessibility check

### Output

#### Dataset (per page)

Each dataset item includes:

- `twitterTags` (all extracted tags)
- `twitterCard`, `twitterTitle`, `twitterDescription`, `twitterImage`, `twitterImages`
- `hasRequiredTags`, `missingRequiredTags`, `duplicateNames`
- `warnings`, `errors`

#### Key-Value Store

- `SUMMARY`: run totals and settings
- `REPORT`: `{ summary, pages: [...] }` simplified page-by-page report

### Common use cases

- SEO QA / social preview QA before publishing
- Site-wide audits for missing Twitter card tags
- Detect duplicate/incorrect `twitter:card` values

### Quick start

Store page: https://apify.com/scrappy\_garden/twitter-card-validator

Paste this into **Input** and click **Run**:

```json
{
  "startUrls": [
    {
      "url": "https://example.com/"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

### Outputs (what you get)

- **Dataset**: Dataset items typically include fields like: `url`, `loadedUrl`, `statusCode`, `title`, `twitterCard`, `twitterTitle`, `twitterDescription`, `twitterImage`, `hasRequiredTags`, `missingRequiredTags`.
- **Key-value store**: `REPORT`, `SUMMARY`

### Tips (trust + predictable results)

- Start with 1–3 URLs to validate behavior, then scale up.
- If a target blocks requests, enable Proxy and/or slow down concurrency in Input.
- Use the `SUMMARY` / `REPORT` keys (when present) for automation pipelines and monitoring.

### Related actors

- broken-link-checker (https://apify.com/scrappy\_garden/broken-link-checker)
- canonical-url-checker (https://apify.com/scrappy\_garden/canonical-url-checker)
- meta-tag-analyzer (https://apify.com/scrappy\_garden/meta-tag-analyzer)
- security-headers-checker (https://apify.com/scrappy\_garden/security-headers-checker)

### Search keywords

twitter card validator, twitter card validator - validate twitter:\* meta tags for x/twitter previews, website audit, seo, twitter card

# Actor input Schema

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

One or more URLs to audit for Twitter Card meta tags.

## `maxPages` (type: `integer`):

Maximum number of pages to process.

## `followLinks` (type: `boolean`):

If enabled, the actor will crawl internal links starting from Start URLs (depth-limited).

## `maxDepth` (type: `integer`):

When Follow links is enabled: how deep to crawl from the Start URLs (0 = only start pages).

## `sameDomainOnly` (type: `boolean`):

When Follow links is enabled: only crawl URLs on the same domain(s) as the Start URLs.

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

Maximum time per page fetch. Increase for slow sites.

## `checkRequiredTags` (type: `boolean`):

If enabled, reports missing or empty required Twitter card tags.

## `requiredTags` (type: `array`):

If provided, overrides the default required list.

## `validateCardType` (type: `boolean`):

Warn if twitter:card is present but not one of summary, summary\_large\_image, app, player.

## `validateImageUrls` (type: `boolean`):

If enabled, performs a lightweight HTTP check for twitter:image URLs (status code + content-type).

## `maxImageChecksPerPage` (type: `integer`):

Limit how many twitter:image URLs to validate per page (when Validate twitter:image URLs is enabled).

## `proxyConfiguration` (type: `object`):

Proxy settings for accessing websites.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://example.com"
    }
  ],
  "maxPages": 50,
  "followLinks": false,
  "maxDepth": 1,
  "sameDomainOnly": true,
  "timeoutSecs": 30,
  "checkRequiredTags": true,
  "requiredTags": [
    "twitter:card",
    "twitter:title",
    "twitter:description",
    "twitter:image"
  ],
  "validateCardType": true,
  "validateImageUrls": false,
  "maxImageChecksPerPage": 3,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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://example.com"
        }
    ],
    "requiredTags": [
        "twitter:card",
        "twitter:title",
        "twitter:description",
        "twitter:image"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrappy_garden/twitter-card-validator").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://example.com" }],
    "requiredTags": [
        "twitter:card",
        "twitter:title",
        "twitter:description",
        "twitter:image",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("scrappy_garden/twitter-card-validator").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 '{
  "startUrls": [
    {
      "url": "https://example.com"
    }
  ],
  "requiredTags": [
    "twitter:card",
    "twitter:title",
    "twitter:description",
    "twitter:image"
  ]
}' |
apify call scrappy_garden/twitter-card-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scrappy_garden/twitter-card-validator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/D2ebXh5PGUj4cns5V/builds/2mXHJS0fliNvSSMmV/openapi.json
