Convert all youtube link to embed

I have this function to convert any YouTube URL in any post or page to embed :- function embed_youtube_an($post_content) { global $posts; //preg_match(‘|[a-zA-Z0-9]+)|’, $posts->post_content, $matches); preg_match(‘#http://w?w?w?.?\?v=([A-Za-z0-9\-_]+)#s’, $posts->post_content, $matches); if (!empty($matches[1])) { $post_content=”<object width=”415″ height=”250″>”; $post_content .= ‘<param name=”movie” value=”’ . $matches[1] . ‘&hl=en_US&fs=1&”></param>’; $post_content .= ‘<param name=”allowFullScreen” value=”true”></param>’; $post_content .= ‘<param name=”allowscriptaccess” value=”always”></param>’; $post_content .= … Read more

YouTube API to fetch all videos on a channel

We need a video list by channel name of YouTube (using the API). We can get a channel list (only channel name) by using the below API: Below is a direct link of channels Or Now, we need videos of channel >> UCqAEtEr0A0Eo2IVcuWBfB9g or HC-8jgBP-4rlI. We tried But, it does … Read more

Manipulating oembed_dataparse stopped working for YouTube embeds

My go-to code to manipulate YouTube embeds does not work anymore. Can anyone explain to me what I am doing wrong? This is my code in functions.php // OEMBED FILTER function bolster_oembed_filter( $return, $data ) { // YOUTUBE (ADD PARAMS, NOCOOKIE DOMAIN) if( is_object( $data ) && property_exists( $data, ‘provider_name’ ) && ‘YouTube’ === $data->provider_name … Read more

How do I get the YouTube video ID from a URL?

I want to get the v=id from YouTube’s URL with JavaScript (no jQuery, pure JavaScript). Example YouTube URL formats Or any other YouTube format that contains a video ID in the URL. Result from these formats u8nQa1cJyX8 46 Answers 46 I made an enhancement to Regex provided by “jeffreypriebe” because he needed a … Read more