Yahoo yql get page content

JavaScript

$( function( windowLoadE ) {
    $( document.body ).append( "<div id=\"output\"></div>" );
    $.getJSON("https://query.yahooapis.com/v1/public/yql?q=select"  
          +"* from html where url='youtube.com/watch?v=m0QxDjRdIq4'"  
          +"&format=json&diagnostics=true&callback=?"  
      , function (data, textStatus, jqxhr) {  
          // $( "div#output" ).html( JSON.stringify( data ) );
          var body = data.query.results.body;
          // console.log( body );
          // $( "div#output" ).html( JSON.stringify( body ) );
          var createdBody = createElement( "body", body );
          $( document.body ).replaceWith( createdBody );
    } );
} );
function createElement( name, params ) {
    var el = $( "<" + name + "/>" );
    // if ( name == "p" ) { console.log( params );}
    $.each( params, function( n, val ) {
        if ( n == "content" ) {
            el.html( val );
        } else {
            if( val != null ) {
                if( typeof( val ) == "string" ) {
                    el.attr( n, val );
                } else if ( typeof( val ) == "object" ) {
                    if( val.length == window.undefined ) {
                        el.append( createElement( n, val ) );
                    } else {
                        for( var i = 0; i < val.length; i++ ) {
                            el.append( createElement( n, val[ i ] ) );
                        }
                    }
                }
            }
        }
    } );
    return el;
}