Created
November 7, 2010 19:15
-
-
Save chadhietala/666335 to your computer and use it in GitHub Desktop.
Uses jQuery, YQL, JSONp and creates the video object on the fly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
var yqlurl= "http://query.yahooapis.com/v1/public/yql?q=" | |
+ "select%20*%20from%20youtube.search%20where%20query%3D" | |
+"'umflint'%20limit%2010&format=json&diagnostics=true&env=" | |
+"store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=?"; | |
// Build this | |
var build = function(data){$.each(data.query.results.video, function(i, video){ | |
$('<h1><a href="' + video.url +' target="_blank\"/></h1>') | |
.html(video.title).appendTo($('#main')); | |
$('<object width="400" height="241" class="clickvid"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" />' | |
+ '<param name="movie" value="' + video.files.file[0].content + '" />' + | |
'<embed src="' + video.files.file[0].content + '" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="250">' + | |
'<\/embed><\/object>') | |
.appendTo($('#main')); | |
}); | |
} | |
$.getJSON(yqlurl, build); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment