oEmbed
- -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.
- -This document is stored on GitHub.
- -Table Of Contents
- --
-
- Quick Example -
- Full Spec -
- Security considerations -
- Discovery -
- More examples -
- Authors -
- Implementations -
1. Quick Example
+ + +1. Quick Example
+A consumer (e.g. WordPress) makes the following HTTP request:
@@ -121,7 +30,11 @@This allows the consumer to turn a URL to a Flickr photo page into structured data to allow embedding of that photo in the consumer's website.
-2. Full Spec
+2. Full Spec
+This spec is broken into three parts - configuration, the consumer request and the provider response.
@@ -341,14 +254,22 @@ -3. Security considerations
+3. Security considerations
+When a consumer displays any URLs, they will probably want to filter the URL scheme to be one of http, https or mailto, although providers are free to specify any valid URL. Without filtering, Javascript:... style URLs could be used for XSS attacks.
When a consumer displays HTML (as with video embeds), there's a vector for XSS attacks from the provider. To avoid this, it is recommended that consumers display the HTML in an iframe, hosted from another domain. This ensures that the HTML cannot access cookies from the consumer domain.
4. Discovery
+4. Discovery
+oEmbed providers can choose to make their oEmbed support discoverable by adding <link> elements to the head of their existing (X)HTML documents or by setting Link headers.
5. More examples
+5. More examples
+5.1. Video example
Request:
-https://www.youtube.com/oembed?url=https%3A//youtube.com/watch%3Fv%3DM3r2XDceM6A&format=json+
https://www.youtube.com/oembed?url=https%3A//youtube.com/watch%3Fv%3DM3r2XDceM6A&format=json
Response:
@@ -411,7 +336,7 @@Request:
-http://iamcal.com/oembed/?url=http%3A//www.iamcal.com/linklog/1206113631/&format=xml+
http://iamcal.com/oembed/?url=http%3A//www.iamcal.com/linklog/1206113631/&format=xml
Response:
@@ -427,7 +352,11 @@ </oembed> -6. Authors
+6. Authors
+- Cal Henderson (cal [at] iamcal.com) @@ -437,7 +366,11 @@
7. Implementations
+7. Implementations
+7.1. Providers
@@ -450,7 +383,7 @@ $dh = opendir(__DIR__.'/../providers'); while (($file = readdir($dh)) !== false){ - if (preg_match('!\.yml$!', $file)){ + if (preg_match('!\\.yml$!', $file)){ $partial = yaml_parse_file(__DIR__."/../providers/$file"); foreach ($partial as $row) $data[] = $row; } @@ -475,31 +408,126 @@7.3. Libraries
- --
-
- PHP: php-oembed (http://code.google.com/p/php-oembed/) -
- PHP: Services_oEmbed (http://pear.php.net/package/Services_oEmbed) -
- PHP: Essence (https://github.com/felixgirault/essence) -
- PHP: Embera (https://github.com/mpratt/Embera) -
- Perl: Web-oEmbed (http://search.cpan.org/~miyagawa/Web-oEmbed/) -
- Ruby: oembed_links (http://github.com/netshade/oembed_links) -
- Python: pyoembed (http://github.com/rafaelmartins/pyoembed/) -
- Python: PyEmbed (http://pyembed.github.io) -
- Python: python-oembed (https://github.com/abarmat/python-oembed) -
- Django: micawber (https://github.com/coleifer/micawber) -
- Java: java-oembed (https://github.com/michael-simons/java-oembed) -
- .Net: oEmbed API Wrapper (http://oembed.codeplex.com/) -
- JQuery: oEmbed API Wrapper (https://github.com/starfishmod/jquery-oembed-all) -
- Node.js: oEmbed API Gateway (https://github.com/itteco/iframely) -
- Elixir: furlex (https://github.com/claytongentry/furlex) -
- Elixir: elixir-oembed (https://github.com/r8/elixir-oembed) -
- AWS: Serverless oEmbed provider (https://github.com/aws-samples/sample-serverless-oembed) -
Disclaimer: These libraries are created and maintained by the community and are not official oEmbed projects.
+PHP: php-oembed
+ http://code.google.com/p/php-oembed/ +PHP: Services_oEmbed
+ http://pear.php.net/package/Services_oEmbed +PHP: Essence
+ https://github.com/felixgirault/essence +PHP: Embera
+ https://github.com/mpratt/Embera +Perl: Web-oEmbed
+ http://search.cpan.org/~miyagawa/Web-oEmbed/ +Ruby: oembed_links
+ https://github.com/netshade/oembed_links +Python: pyoembed
+ https://github.com/rafaelmartins/pyoembed/ +Python: PyEmbed
+ https://github.com/pyembed/pyembed +Python: python-oembed
+ https://github.com/abarmat/python-oembed +Django: micawber
+ https://github.com/coleifer/micawber +Java: java-oembed
+ https://github.com/michael-simons/java-oembed +JQuery: oEmbed API Wrapper
+ https://github.com/starfishmod/jquery-oembed-all +Node.js: oEmbed API Gateway
+ https://github.com/itteco/iframely +Elixir: furlex
+ https://github.com/claytongentry/furlex +Elixir: elixir-oembed
+ https://github.com/r8/elixir-oembed +AWS: Serverless oEmbed provider
+ https://github.com/aws-samples/sample-serverless-oembed +-
Press and Links
+Press and Links
- The official oEmbed mailing list @@ -515,5 +543,4 @@