oEmbed Reference for Developers

oEmbed is an open standard for embedding videos and/or images into a website. You can use the CollegeHumor URL of any video to easily obtain the embed code for that video. To find out more about oEmbed, view the spec or check out Webmonkey's Get Started with oEmbed tutorial.

API Endpoint

You can use the API endpoint to request the embed code for a video from its URL. The response format can be either xml or json.

http://www.collegehumor.com/oembed.format

CollegeHumor videos can use the following URL scheme:

http://www.collegehumor.com/video/*

Discovery

CollegeHumor supports discovery of the oEmbed URL. Each page that has a video will have two link tags with types application/json+oembed and application/xml+oembed containing the URLs for JSON and XML oEmbed responses.

Arguments

All arguments are sent as query parameters and must be urlencoded (as per RFC 1738).

url
(required) The URL to retrieve embedding information for.
maxwidth
(optional) The maximum width of the embedded resource. Only applies to some resource types. Video will not exceed original size.
maxheight
(optional) The maximum height of the embedded resource. Only applies to some resource types. Video will not exceed original size.
autoplay
(optional) Allows for the video to start upon completion if set to true. Defaults to false.

Example Call

http://www.collegehumor.com/oembed.xml?url=http://www.collegehumor.com/video/*/title

Example Responses

These are sample responses (they have been shortened for formatting). If a video's privacy is set to anything other than public or password protected, only the embed code, width, and height will be returned.

XML

Call:

http://www.collegehumor.com/oembed.xml?url=http%3A%2F%2Fwww.collegehumor.com%2Fvideo%2F6669821%2Fthe-twelve-beards-of-christmas

Response:

<oembed>
<type>video</type>
<version>1.0</version>
<title>The Twelve Beards of Christmas</title>
<author_name>CollegeHumor</author_name>
<author_url>http://www.collegehumor.com</author_url>
<provider_name>CollegeHumor</provider_name>
<provider_url>http://www.collegehumor.com</provider_url>
<height>338</height>
<width>600</width>
<html>
<object embed code>
</html>
<thumbnail_url>
http://0.media.collegehumor.cvcdn.com/20/37/e1685db33f636af5130d5132c264074e.jpg</thumbnail_url>
<thumbnail_width>175</thumbnail_width>
<thumbnail_height>98</thumbnail_height>
</oembed>
	

JSON

Call:

http://www.collegehumor.com/oembed.json?url=http%3A%2F%2Fwww.collegehumor.com%2Fvideo%2F6669821%2Fthe-twelve-beards-of-christmas&maxwidth=400

Response:

{
"type":"video",
"version":"1.0",
"title":"The Twelve Beards of Christmas",
"author_name":"CollegeHumor",
"author_url":"http:\/\/www.collegehumor.com",
"provider_name":"CollegeHumor",
"provider_url":"http:\/\/www.collegehumor.com",
"width":400,
"height":225,
"html":"object embed code",
"thumbnail_url":"http:\/\/0.media.collegehumor.cvcdn.com\/20\/37\/e1685db33f636af5130d5132c264074e.jpg",
"thumbnail_width":"175",
"thumbnail_height":"98"
}