小编Gus*_*avo的帖子

api.instagram CORB网络错误,原因是具有Content-Type:application / json`的jsonp响应标头

我正在使用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();
})
Run Code Online (Sandbox Code Playgroud)

我的控制台:

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.
Run Code Online (Sandbox Code Playgroud)

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

由于twitter响应具有a的Content-Type: application/javascript作用,而instagram响应具有a的作用Content-Type: application/json却不起作用。

我该如何进行这项工作?

instagram-api

2
推荐指数
1
解决办法
1007
查看次数

标签 统计

instagram-api ×1