oembed

How to correctly use oembed to pull thumbs from youtube

隐身守侯 提交于 2019-12-06 01:17:31
I show a lot of thumbs on my homepage from youtube videos. I was using this function below to grab the thumb from a youtube url which works fast but it doesn't work for url's in the shortned form like youtu.be/JSHDLSKL. function get_youtube_screen_link( $url = '', $type = 'default', $echo = true ) { if( empty( $url ) ) return false; if( !isset( $type ) ) $type = ''; $url = esc_url( $url ); preg_match("|[\\?&]v=([^&#]*)|",$url,$vid_id); if( !isset( $vid_id[1] ) ) return false; $img_server_num = 'i'. rand(1,4); switch( $type ) { case 'large': $img_link = "http://{$img_server_num}.ytimg.com/vi/{

Embed youtube videos using oembed

强颜欢笑 提交于 2019-12-05 09:26:05
I want to use oembed to get the embed code from youtube links with jQuery: var url = "http://www.youtube.com/watch?v=iwGFalTRHDA"; url = encodeURIComponent(url); $.getJSON('http://youtube.com/oembed?url='+url+'&format=json', function(data) { console.log(data); }); Well I don't get any data. Funny thing is, that if I browse to the url I get the right response: http://www.youtube.com/oembed?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DiwGFalTRHDA&format=json` leads me to { provider_url: "http://www.youtube.com/" title: "Trololo" html: "<object width="425" height="344"><param name="movie" value

How to use oembed tags to implement rich pins

五迷三道 提交于 2019-12-05 06:22:43
I need to implement rich pins provided by pinterest ( http://developers.pinterest.com/rich_pins/ ). One of the recommended ways is to use oembed. Unfortunately I am not familiar with oembed tags and was wondering if somebody can provide more insight. What is the syntax for oembed tags? Should I surround with tags? Any particular place where it should be called? Any help will be appreciated. TIA This gives examples, but given the SEO benefits of using structured data, it might be more beneficial to use that instead for pinterest. Meta tags can also be used From the link above: An oEmbed formula

CORS error with window.fetch on YouTube resource

时光总嘲笑我的痴心妄想 提交于 2019-12-02 02:29:10
问题 I'm using window.fetch to retrieve a YouTube resource with the following URL: http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=[id]&format=json Using Fiddler, I see that I am getting the expected reply from YouTube's servers containing JSON data. However, I'm not able to use it as I'm getting a Javascript error. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:60366' is therefore not allowed access. I tried enabling CORS on

CORS error with window.fetch on YouTube resource

故事扮演 提交于 2019-12-02 01:32:13
I'm using window.fetch to retrieve a YouTube resource with the following URL: http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=[id]&format=json Using Fiddler, I see that I am getting the expected reply from YouTube's servers containing JSON data. However, I'm not able to use it as I'm getting a Javascript error. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:60366 ' is therefore not allowed access. I tried enabling CORS on my window.fetch but I read that this will only work if the server allows CORS in its header response

Response for JSONp request to youtube oembed call giving “invalid label” error

你离开我真会死。 提交于 2019-11-27 07:57:20
问题 I am making a JSONp call to youtube using oembed and on response firebug gives "invalid label" error Here is my code site = "www.youtube.com"; url = "http://www.youtube.com/watch?v=slORb622ZI8"; $.getJSON("http://"+site+"/oembed?callback=?",{"format":"json","url":url},function(data){ alert("hello:\n"+data); alert(data.provider_url); }); Anyone ran into similar problem with oembed jsonp requests? 回答1: Problem YouTube API doesn't support JSONP - see: Issue 4329: oEmbed callback for JSONP.