Table of Contents
oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.
Key features:
- Simple HTTP-based protocol
- Support for photos, videos, links, and rich content
- Standardized response format
- Wide adoption by major content providers
This repository serves two main purposes:
- oEmbed Specification: Contains the current oEmbed spec as seen at oembed.com and any drafts in the
wwwdirectory. - Provider Registry: Maintains configuration information for oEmbed providers as YAML files in the
providersdirectory.
To work with this repository, you'll need:
- Web Server: Nginx or Apache
- PHP: For running the specification website
- Node.js: Version 22 or higher
- npm: For package management
-
Clone the repository:
git clone https://github.com/iamcal/oembed.git cd oembed -
Install dependencies:
npm install
-
Configure your development environment:
# Install development dependencies npm install --dev # Set up pre-commit hooks npm run prepare
-
Run tests:
npm test
Install the package via npm:
npm install oembed-providersThe provider registry will be available at:
node_modules/oembed-providers/providers.json
Each provider is configured using a YAML file in the providers directory. The configuration specifies:
- Provider name and URL
- Endpoint information
- Supported URL schemes
- Discovery settings
- Documentation links
Basic oEmbed Request:
// Example: Fetching oEmbed data from Flickr
const url = 'http://www.flickr.com/services/oembed/';
const params = new URLSearchParams({
format: 'json',
url: 'http://www.flickr.com/photos/bees/2341623661/'
});
fetch(`${url}?${params}`)
.then(response => response.json())
.then(data => console.log(data));Example Response:
{
"version": "1.0",
"type": "photo",
"width": 240,
"height": 160,
"title": "ZB8T0193",
"url": "http://farm4.static.flickr.com/3123/2341623661_7c99f48bbf_m.jpg",
"author_name": "Bees",
"author_url": "http://www.flickr.com/photos/bees/",
"provider_name": "Flickr",
"provider_url": "http://www.flickr.com/"
}The registry includes providers such as:
- YouTube
- Vimeo
- Flickr
- And many more...
For a complete list, browse the providers directory.
- Create a new YAML file in the
providersdirectory - Follow the provider configuration format
- Submit a pull request
---
- provider_name: Example Provider
provider_url: https://example.com
endpoints:
- schemes:
- https://example.com/watch/*
- https://example.com/v/*
url: https://example.com/oembed
docs_url: https://example.com/docs/oembed
example_urls:
- https://example.com/oembed?url=https://example.com/watch/123
discovery: trueWe welcome contributions! Please read our Contributing Guidelines before submitting pull requests.
Key areas for contribution:
- Adding new providers
- Updating existing provider configurations
- Improving documentation
- Fixing bugs
- Adding tests
Need help? Here's how to get support:
This project is licensed under the MIT License - see the LICENSE file for details.