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(‘|http://www.youtube.com/watch?v=([a-zA-Z0-9]+)|’, $posts->post_content, $matches); preg_match(‘#http://w?w?w?.?youtube.com/watch\?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=”http://www.youtube.com/v/’ . $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: https://gdata.youtube.com/feeds/api/channels?v=2&q=tendulkar Below is a direct link of channels https://www.youtube.com/channel/UCqAEtEr0A0Eo2IVcuWBfB9g Or WWW.YouTube.com/channel/HC-8jgBP-4rlI Now, we need videos of channel >> UCqAEtEr0A0Eo2IVcuWBfB9g or HC-8jgBP-4rlI. We tried https://gdata.youtube.com/feeds/api/videos?v=2&uploader=partner&User=UC7Xayrf2k0NZiz3S04WuDNQ https://gdata.youtube.com/feeds/api/videos?v=2&uploader=partner&q=UC7Xayrf2k0NZiz3S04WuDNQ 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 http://www.youtube.com/watch?v=u8nQa1cJyX8&a=GxdCwVVULXctT2lYDEPllDR0LRTutYfW http://www.youtube.com/watch?v=u8nQa1cJyX8 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