1. WizTools.org
  2. Untitled project
  3. oembed

Overview

HTTPS SSH

About

Java implementation of the oEmbed specification from WizTools.org. Originally developed for use in FileIt.in, and still used there.

The library requires Java 7.

Maven Import

<dependency>
    <groupId>org.wiztools</groupId>
    <artifactId>wiztools-oembed</artifactId>
    <version>0.2.0</version>
</dependency>

Usage

import org.wiztools.oembed.*;
import java.net.URL;

...

URL url = new URL("http://www.youtube.com/oembed?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DDcexJQM-8W0&format=xml");

// Now execute:
OEmbedExecutor exec = new OEmbedHttpExecutor();
OEmbedResponse response = exec.get(url);

// Print the result:
System.out.println(response.getHtml());

Using Url Builder

import org.wiztools.oembed.OEmbedUrlBuilder;
import java.net.URL;

...

OEmbedUrlBuilder builder = new OEmbedUrlBuilder("http://www.youtube.com/oembed");
URL url = builder.addUrl("http://www.youtube.com/watch?v=DcexJQM-8W0")
       .addFormatXml()
       .build();

Design Goals

  • Simple and extensible.
  • Minimal third-party dependency.
  • Built in validation.