Prepare content from a different CMS/WYSIWYG to the WordPress editor

Wrap the url in the </code></a> shortcode. This will force wordpress to call it's oEmbed implementation.</p>

<pre><code> https://www.youtube.com/watch?v=YE7VzlLtp-4

Or, if you want to be able to control the height/width

   

Note, this will only work for websites that are wordpress’s whitelist of sites. You can add sites to this list using wp_embed_register_handler

Edit
If you want to check if your provider is in the whitelist, could consider doing something like this (Note, I’ve never tested the below before):

    function prefix_is_whitelisted_embed($url){
        require_once( ABSPATH . WPINC . '/class-oembed.php' );

        if ( did_action( 'plugins_loaded' ) ) { //if you do this before plugins are loaded you may prevent other plugins from adding urls to the whitelist
            $oEmbed = _wp_oembed_get_object();
            return $oEmbed->get_provider($url) === false?false:true;
        }
    }

This function basically checks to see if a url has a registered provider using the WP oEmbed object. If it does, the class method get_provider() returns the provider, if it doesn’t it should return bool false. This function just checks for that bool false and returns based on that.