Skip to content

Open Graph

Parse Open Graph, Twitter Card and HTML link-preview metadata from HTML text or URLs

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/opengraph/index.md to help me query Open Graph with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Pull the title and preview image out of an HTML document

Example output · captured
Connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
SELECT og.title, og.image
FROM (SELECT opengraph.main.parse_opengraph('<html lang="en"><head><title>Fallback</title><meta property="og:title" content="Rock &amp; Roll"><meta property="og:image" content="/cover.png"></head></html>') AS og)
Result
title image
Rock & Roll /cover.png

Quick start

Choose where to run Open Graph, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the release directly

Downloads the latest release for your platform and caches it locally.

ATTACH 'opengraph' AS opengraph (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-opengraph'
);

3. Run a query

query.sql
SELECT og.title, og.image
FROM (SELECT opengraph.main.parse_opengraph('<html lang="en"><head><title>Fallback</title><meta property="og:title" content="Rock &amp; Roll"><meta property="og:image" content="/cover.png"></head></html>') AS og)
More example queries →
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the release directly

Uses the verified release each time you attach the connector.

ATTACH 'opengraph' AS opengraph (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

Link-preview metadata from web pages: Open Graph, Twitter Card and plain HTML fallbacks such as title, description, canonical URL and favicon, parsed from HTML you already hold or fetched from URLs with per-row HTTP errors.

Catalog

Everything opengraph exposes once attached — read straight from the worker's released build.

opengraph 1 schema
main 3 functions

Scalars that parse or fetch Open Graph, Twitter Card and HTML link-preview metadata.

Schema examples (6)
Examples (6)

Pull the title and preview image out of an HTML document

SELECT og.title, og.image
FROM (SELECT opengraph.main.parse_opengraph('<html lang="en"><head><title>Fallback</title><meta property="og:title" content="Rock &amp; Roll"><meta property="og:image" content="/cover.png"></head></html>') AS og);
Result
title image
Rock & Roll /cover.png

Resolve a relative og:image against the page URL

SELECT opengraph.main.parse_opengraph('<html lang="en"><head><title>Fallback</title><meta property="og:title" content="Rock &amp; Roll"><meta property="og:image" content="/cover.png"></head></html>', 'https://example.com/music/').image AS image;

Build article preview cards from crawled HTML: title and absolute image from parse_opengraph(html, base_url), plus the article:tag keywords (not in the summary) collected from opengraph_tags

WITH pages(page_url, html) AS (VALUES ('https://blog.example.com/posts/duckdb', '<title>Blog</title><meta property="og:title" content="Why DuckDB"><meta property="og:image" content="/img/duck.png"><meta property="article:tag" content="duckdb"><meta property="article:tag" content="sql">'), ('https://blog.example.com/posts/hello', '<title>Hello, world</title><meta property="article:tag" content="intro">')) SELECT page_url, og.title, og.image, article_tags
FROM (SELECT page_url, opengraph.main.parse_opengraph(html, page_url) AS og, [t.content FOR t IN opengraph.main.opengraph_tags(html) IF t.property = 'article:tag'] AS article_tags FROM pages)
ORDER BY page_url;

Unnest the raw meta tags of a document

SELECT t.property, t.content
FROM (SELECT unnest(opengraph.main.opengraph_tags('<meta property="og:type" content="article"><meta property="article:author" content="Ada">')) AS t)
ORDER BY t.property;
2 more examples

Audit where each page's preview title comes from: check the raw tags from opengraph_tags for og:title or twitter:title, else parse_opengraph fell back to the <title> element

WITH pages(page_url, html) AS (VALUES ('https://shop.example.com/a', '<title>Shop A</title><meta property="og:title" content="Spring Sale">'), ('https://shop.example.com/b', '<title>Shop B</title><meta name="twitter:title" content="B on Twitter">'), ('https://shop.example.com/c', '<title>Shop C</title>')) SELECT page_url, preview_title, CASE WHEN list_contains(props, 'og:title') THEN 'og:title' WHEN list_contains(props, 'twitter:title') THEN 'twitter:title' ELSE '<title> fallback' END AS title_source
FROM (SELECT page_url, opengraph.main.parse_opengraph(html).title AS preview_title, [t.property FOR t IN opengraph.main.opengraph_tags(html)] AS props FROM pages)
ORDER BY page_url;

Unfurl a link the way a chat app would

SELECT og.title, og.site_name, og.image
FROM (SELECT opengraph.main.fetch_opengraph('https://github.com/duckdb/duckdb') AS og)
WHERE og.error IS NULL;
Scalar functions
fetch_opengraph (url VARCHAR) 1 example

Download a web page and return its Open Graph metadata as a STRUCT, with HTTP status and error.

Arguments
url VARCHAR
http:// or https:// page URL to fetch; redirects are followed. NULL in, NULL out.
ReturnsSTRUCT of 23 fields
STRUCT 23 fields
  • titleVARCHAR
  • descriptionVARCHAR
  • typeVARCHAR
  • urlVARCHAR
  • site_nameVARCHAR
  • localeVARCHAR
  • imageVARCHAR
  • image_altVARCHAR
  • image_widthINTEGER
  • image_heightINTEGER
  • imagesVARCHAR[]
  • videoVARCHAR
  • audioVARCHAR
  • twitter_cardVARCHAR
  • twitter_siteVARCHAR
  • twitter_creatorVARCHAR
  • canonical_urlVARCHAR
  • favicon_urlVARCHAR
  • oembed_urlVARCHAR
  • final_urlVARCHAR
  • http_statusINTEGER
  • content_typeVARCHAR
  • errorVARCHAR
Example

Unfurl a link the way a chat app would

SELECT og.title, og.site_name, og.image
FROM (SELECT opengraph.main.fetch_opengraph('https://github.com/duckdb/duckdb') AS og)
WHERE og.error IS NULL;
Link
opengraph_tags (html VARCHAR) 2 examples

List every property/name and content pair in an HTML document, in document order.

Arguments
html VARCHAR
HTML document text; NULL in, NULL out.
ReturnsSTRUCT(property VARCHAR, "content" VARCHAR)[]
Examples (2)

Unnest the raw meta tags of a document

SELECT t.property, t.content
FROM (SELECT unnest(opengraph.main.opengraph_tags('<meta property="og:type" content="article"><meta property="article:author" content="Ada">')) AS t)
ORDER BY t.property;

Audit where each page's preview title comes from: check the raw tags from opengraph_tags for og:title or twitter:title, else parse_opengraph fell back to the <title> element

WITH pages(page_url, html) AS (VALUES ('https://shop.example.com/a', '<title>Shop A</title><meta property="og:title" content="Spring Sale">'), ('https://shop.example.com/b', '<title>Shop B</title><meta name="twitter:title" content="B on Twitter">'), ('https://shop.example.com/c', '<title>Shop C</title>')) SELECT page_url, preview_title, CASE WHEN list_contains(props, 'og:title') THEN 'og:title' WHEN list_contains(props, 'twitter:title') THEN 'twitter:title' ELSE '<title> fallback' END AS title_source
FROM (SELECT page_url, opengraph.main.parse_opengraph(html).title AS preview_title, [t.property FOR t IN opengraph.main.opengraph_tags(html)] AS props FROM pages)
ORDER BY page_url;
Link
parse_opengraph (html VARCHAR, base_url VARCHAR) +1 overload 4 examples

Parse Open Graph, Twitter Card and basic HTML metadata from an HTML document into a STRUCT.

Arguments
html VARCHAR
HTML document text (a full page or just its <head>); NULL in, NULL out.
base_url VARCHAR
URL the HTML was fetched from, e.g. 'https://example.com/post/1'. Relative image, url, video, audio, canonical, favicon and oEmbed values are resolved against it (a <base href> in the page takes precedence). NULL leaves URLs as written.
Overloads
parse_opengraph(html VARCHAR) → STRUCT of 19 fieldsparse_opengraph(html VARCHAR, base_url VARCHAR) → STRUCT of 19 fields
ReturnsSTRUCT of 19 fields
STRUCT 19 fields
  • titleVARCHAR
  • descriptionVARCHAR
  • typeVARCHAR
  • urlVARCHAR
  • site_nameVARCHAR
  • localeVARCHAR
  • imageVARCHAR
  • image_altVARCHAR
  • image_widthINTEGER
  • image_heightINTEGER
  • imagesVARCHAR[]
  • videoVARCHAR
  • audioVARCHAR
  • twitter_cardVARCHAR
  • twitter_siteVARCHAR
  • twitter_creatorVARCHAR
  • canonical_urlVARCHAR
  • favicon_urlVARCHAR
  • oembed_urlVARCHAR
Examples (4)

Pull the title and preview image out of an HTML document

SELECT og.title, og.image
FROM (SELECT opengraph.main.parse_opengraph('<html lang="en"><head><title>Fallback</title><meta property="og:title" content="Rock &amp; Roll"><meta property="og:image" content="/cover.png"></head></html>') AS og);
Result
title image
Rock & Roll /cover.png

Resolve a relative og:image against the page URL

SELECT opengraph.main.parse_opengraph('<html lang="en"><head><title>Fallback</title><meta property="og:title" content="Rock &amp; Roll"><meta property="og:image" content="/cover.png"></head></html>', 'https://example.com/music/').image AS image;

Build article preview cards from crawled HTML: title and absolute image from parse_opengraph(html, base_url), plus the article:tag keywords (not in the summary) collected from opengraph_tags

WITH pages(page_url, html) AS (VALUES ('https://blog.example.com/posts/duckdb', '<title>Blog</title><meta property="og:title" content="Why DuckDB"><meta property="og:image" content="/img/duck.png"><meta property="article:tag" content="duckdb"><meta property="article:tag" content="sql">'), ('https://blog.example.com/posts/hello', '<title>Hello, world</title><meta property="article:tag" content="intro">')) SELECT page_url, og.title, og.image, article_tags
FROM (SELECT page_url, opengraph.main.parse_opengraph(html, page_url) AS og, [t.content FOR t IN opengraph.main.opengraph_tags(html) IF t.property = 'article:tag'] AS article_tags FROM pages)
ORDER BY page_url;
1 more example
SELECT opengraph.main.parse_opengraph('<html lang="en"><head><title>Fallback</title><meta property="og:title" content="Rock &amp; Roll"><meta property="og:image" content="/cover.png"></head></html>', 'https://example.com/music/').image AS image
ORDER BY ALL;
Link

Try these queries

Resolve a relative og:image against the page URL

SELECT opengraph.main.parse_opengraph('<html lang="en"><head><title>Fallback</title><meta property="og:title" content="Rock &amp; Roll"><meta property="og:image" content="/cover.png"></head></html>', 'https://example.com/music/').image AS image

Uses parse_opengraph

Build article preview cards from crawled HTML: title and absolute image from parse_opengraph(html, base_url), plus the article:tag keywords (not in the summary) collected from opengraph_tags

WITH pages(page_url, html) AS (VALUES ('https://blog.example.com/posts/duckdb', '<title>Blog</title><meta property="og:title" content="Why DuckDB"><meta property="og:image" content="/img/duck.png"><meta property="article:tag" content="duckdb"><meta property="article:tag" content="sql">'), ('https://blog.example.com/posts/hello', '<title>Hello, world</title><meta property="article:tag" content="intro">')) SELECT page_url, og.title, og.image, article_tags
FROM (SELECT page_url, opengraph.main.parse_opengraph(html, page_url) AS og, [t.content FOR t IN opengraph.main.opengraph_tags(html) IF t.property = 'article:tag'] AS article_tags FROM pages)
ORDER BY page_url

Uses parse_opengraphopengraph_tags

Unnest the raw meta tags of a document

SELECT t.property, t.content
FROM (SELECT unnest(opengraph.main.opengraph_tags('<meta property="og:type" content="article"><meta property="article:author" content="Ada">')) AS t)
ORDER BY t.property

Uses opengraph_tags

Audit where each page's preview title comes from: check the raw tags from opengraph_tags for og:title or twitter:title, else parse_opengraph fell back to the <title> element

WITH pages(page_url, html) AS (VALUES ('https://shop.example.com/a', '<title>Shop A</title><meta property="og:title" content="Spring Sale">'), ('https://shop.example.com/b', '<title>Shop B</title><meta name="twitter:title" content="B on Twitter">'), ('https://shop.example.com/c', '<title>Shop C</title>')) SELECT page_url, preview_title, CASE WHEN list_contains(props, 'og:title') THEN 'og:title' WHEN list_contains(props, 'twitter:title') THEN 'twitter:title' ELSE '<title> fallback' END AS title_source
FROM (SELECT page_url, opengraph.main.parse_opengraph(html).title AS preview_title, [t.property FOR t IN opengraph.main.opengraph_tags(html)] AS props FROM pages)
ORDER BY page_url

Uses parse_opengraphopengraph_tags

Unfurl a link the way a chat app would

SELECT og.title, og.site_name, og.image
FROM (SELECT opengraph.main.fetch_opengraph('https://github.com/duckdb/duckdb') AS og)
WHERE og.error IS NULL

Uses fetch_opengraph

A relative og:image becomes absolute

SELECT opengraph.main.parse_opengraph('<html lang="en"><head><title>Fallback</title><meta property="og:title" content="Rock &amp; Roll"><meta property="og:image" content="/cover.png"></head></html>', 'https://example.com/music/').image AS image
ORDER BY ALL;

Uses parse_opengraph

Open Graph is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.