Assuming your content is in the variable $content
you would begin by removing all html tags using wp_strip_all_tags
:
$new_content = wp_strip_all_tags( $content );
Then you will want to trim that to 200 characters using substr
:
$new_content = substr( $new_content, 0, 200 );
To retrieve the YouTube video, you’ll need to use preg_match
:
preg_match( '/(<iframe.*?src="https://wordpress.stackexchange.com/questions/154352/(.*?youtube.*?)".*?<\/iframe>)/', $html, $matches );
if ( $matches ) {
$iframe = $matches[1];
$url = $matches[2];
}
(I wasn’t sure whether you wanted the iframe for embedding, or the src URL, so I’ve included matching for both.)