Instagram oEmbed ajax响应不一致

时间:2015-09-16 13:29:00

标签: javascript jquery instagram oembed

按照此页面上的信息:https://instagram.com/developer/embedding/#oembed

我使用以下代码将相关数据提取到Instagram图像:

$.ajax({
    url: 'http://api.instagram.com/oembed?url=http://instagr.am/p/7r9B_RrKln/',
    type: 'GET',
    cache: false,
    dataType: 'jsonp',
    success: function(data){
        console.log(data)
    }, error: function(){
        console.log('error');
    }

});

现在我在使用示例中的Instagram图像链接时得到的响应如下:

Object
author_id: 9538472
author_name: "diegoquinteiro"
author_url: "https://instagram.com/diegoquinteiro"
height: null
html: "<blockquote class="instagram-media" data-instgrm-captioned data-instgrm-version="4" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);"><div style="padding:8px;"> <div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:50% 0; text-align:center; width:100%;"> <div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAAGFBMVEUiIiI9PT0eHh4gIB4hIBkcHBwcHBwcHBydr+JQAAAACHRSTlMABA4YHyQsM5jtaMwAAADfSURBVDjL7ZVBEgMhCAQBAf//42xcNbpAqakcM0ftUmFAAIBE81IqBJdS3lS6zs3bIpB9WED3YYXFPmHRfT8sgyrCP1x8uEUxLMzNWElFOYCV6mHWWwMzdPEKHlhLw7NWJqkHc4uIZphavDzA2JPzUDsBZziNae2S6owH8xPmX8G7zzgKEOPUoYHvGz1TBCxMkd3kwNVbU0gKHkx+iZILf77IofhrY1nYFnB/lQPb79drWOyJVa/DAvg9B/rLB4cC+Nqgdz/TvBbBnr6GBReqn/nRmDgaQEej7WhonozjF+Y2I/fZou/qAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px; position:relative; top:-22px; width:44px;"></div></div> <p style=" margin:8px 0 0 0; padding:0 4px;"> <a href="https://instagram.com/p/fA9uwTtkSN/" style=" color:#000; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none; word-wrap:break-word;" target="_top">Wii Gato (Lipe Sleep)</a></p> <p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;">A video posted by @diegoquinteiro on <time style=" font-family:Arial,sans-serif; font-size:14px; line-height:17px;" datetime="2013-10-03T18:19:39+00:00">Oct 3, 2013 at 11:19am PDT</time></p></div></blockquote>↵<script async defer src="//platform.instagram.com/en_US/embeds.js"></script>"
media_id: "558717847597368461_9538472"
provider_name: "Instagram"
provider_url: "https://instagram.com/"
thumbnail_height: 640
thumbnail_url: "https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/e15/11358196_1472850273007829_614249870_n.jpg"
thumbnail_width: 640
title: "Wii Gato (Lipe Sleep)"
type: "rich"
version: "1.0"
width: 658

这很棒,因为它包含了我需要的一切,但是当我使用任何其他Instagram图像链接时,在我尝试的所有内容中,我只得到一个有限的响应,错过了关键数据,如缩略图链接,即

Object
author_id: 395740924
author_name: "officialfoodgroup"
author_url: "https://instagram.com/officialfoodgroup"
height: null
html: "<blockquote class="instagram-media" data-instgrm-captioned data-instgrm-version="4" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);"><div style="padding:8px;"> <div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:50.0% 0; text-align:center; width:100%;"> <div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAAGFBMVEUiIiI9PT0eHh4gIB4hIBkcHBwcHBwcHBydr+JQAAAACHRSTlMABA4YHyQsM5jtaMwAAADfSURBVDjL7ZVBEgMhCAQBAf//42xcNbpAqakcM0ftUmFAAIBE81IqBJdS3lS6zs3bIpB9WED3YYXFPmHRfT8sgyrCP1x8uEUxLMzNWElFOYCV6mHWWwMzdPEKHlhLw7NWJqkHc4uIZphavDzA2JPzUDsBZziNae2S6owH8xPmX8G7zzgKEOPUoYHvGz1TBCxMkd3kwNVbU0gKHkx+iZILf77IofhrY1nYFnB/lQPb79drWOyJVa/DAvg9B/rLB4cC+Nqgdz/TvBbBnr6GBReqn/nRmDgaQEej7WhonozjF+Y2I/fZou/qAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px; position:relative; top:-22px; width:44px;"></div></div> <p style=" margin:8px 0 0 0; padding:0 4px;"> <a href="https://instagram.com/p/7qoya4jnQw/" style=" color:#000; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none; word-wrap:break-word;" target="_top">We&#39;re here at @slaters5050 getting an exclusive sneak peek tasting of a few of the new additions to the menu! Slater&#39;s 50/50 is one of our all time favorites, so when we say this is heaven to us, we truly mean it... Kicking it off, (Burger 1 of 4), THE SRIRACHA BURGER: Sriracha spiced 50/50 patty, honey Sriracha bacon, pepper jack, charred yellow onion, Sriracha sautéed mushrooms, Sriracha coleslaw, Sriracha mayo. #slatersfoodporn</a></p> <p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;">A photo posted by Official Food Group (@officialfoodgroup) on <time style=" font-family:Arial,sans-serif; font-size:14px; line-height:17px;" datetime="2015-09-15T21:23:47+00:00">Sep 15, 2015 at 2:23pm PDT</time></p></div></blockquote>↵<script async defer src="//platform.instagram.com/en_US/embeds.js"></script>"
media_id: "1074850847781712944_395740924"
provider_name: "Instagram"
provider_url: "https://instagram.com/"
title: "We're here at @slaters5050 getting an exclusive sneak peek tasting of a few of the new additions to the menu! Slater's 50/50 is one of our all time favorites, so when we say this is heaven to us, we truly mean it... Kicking it off, (Burger 1 of 4), THE SRIRACHA BURGER: Sriracha spiced 50/50 patty, honey Sriracha bacon, pepper jack, charred yellow onion, Sriracha sautéed mushrooms, Sriracha coleslaw, Sriracha mayo. #slatersfoodporn"
type: "rich"
version: "1.0"
width: 658

我尝试的那些似乎都不是私人图片,所以我为什么得到有限的回复让我感到困惑。

提前致谢。

0 个答案:

没有答案