gpt4 book ai didi

instagram-api - 由于 jsonp 响应 header 带有 `Content-Type: application/json`,api.instagram CORB 网络错误

转载 作者:行者123 更新时间:2023-12-03 12:20:17 25 4
gpt4 key购买 nike

我正在使用fetch-jsonp获取https://api.instagram.com/oembed/?url=<embedUrl>使用response.html嵌入我的网站。

但我在获取 CORB 的请求时遇到问题错误。

这是我的代码片段:

fetchJsonp("https://api.instagram.com/oembed/?url=" + url, {
timeout: 800,
}).then(function(response) {
return response.json();
})

我的控制台:

Cross-Origin Read Blocking (CORB) blocked cross-origin response https://api.instagram.com/oembed/?url=<embedUrl> with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details.

我使用访问 https://api.twitter.com/1/statuses/oembed.json?url=<embedUrl> 的相同片段代码处理来自 twitter 的嵌入而且效果很好。

由于 Twitter 响应有 Content-Type: application/javascript它有效,但 Instagram 响应有 Content-Type: application/json但事实并非如此。

我怎样才能做到这一点?

最佳答案

我们遇到了同样的问题,但是从 jsonp 切换到 json 就解决了问题。例如:

fetch("https://api.instagram.com/oembed/?url=" + url)
.then(function(response){
return response.json()
})
.then(function(json){
console.log(json)
})

关于instagram-api - 由于 jsonp 响应 header 带有 `Content-Type: application/json`,api.instagram CORB 网络错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53053527/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com