// 'node' and 'yql' are both YUI3 core modules that are available for import.
YUI().use('node', 'yql', function(Y) {
// Specify the YQL query
var query = 'use "http://derek.github.com/sandbox/hackallstars/mediasearch.xml" as mediasearch; SELECT * FROM mediasearch WHERE query="puppies";';
// Define the response handler that is executed when YQL responds with data
var responseHandler = function(response) {
var count, html = [], items, item;
items = response.query.results.item;
count = items.length;
// Loop through each media item
for (var i = 0; i < count; i++) {
// Snag the item from the array
item = items[i];
// Create the HTML for each item
html.push("<div class='item'>");
html.push(" <div>" + item.source + ": " + item.title + "</div>");
html.push(" <img src='" + item.thumb + "'>");
html.push(" <hr />");
html.push("</div>");
};
// Smoosh the HTML together
html = html.join('');
// Insert it into the #tweets node
Y.one("#items").set("innerHTML", html);
}
// Execute the query and send the result to the callback function
new Y.YQL(query, responseHandler);
});
<!-- Hacked together by Derek Gathright (@derek) -->
<div id="items"></div>