Instagram 公共 API 的新 CORS 政策?

I. *_*Sen 16 javascript ajax cors instagram-api referrer-policy

我将这些端点与 JavaScript Ajax 结合使用来获取 Instagram 用户信息和帖子:

https://www.instagram.com/[用户名]/?__a=1

https://www.instagram.com/graphql/query/?query_hash=472f257a40c653c64c666ce877d59d2b&variables={id:[user_id],first:50,after:''}

之前没有 CORS 策略错误,但现在我收到该错误(不是每次刷新页面时,而是几乎 95% 次):

从源“https://sitename.com”访问“https://www.instagram.com/hannahstocking/?__a=1”上的 XMLHttpRequest 已被 CORS 政策阻止:无“访问控制允许源”请求的资源上存在标头。

Instagram 是否已开始阻止这些端点或添加了新的速率限制?我该如何解决?

Let*_*aus 5

Instagram 引入了严格的跨域来源政策,并且只允许以下跨域站点:

  • https://www.instagram.com
  • https://*.fbcdn.net
  • https://*.instagram.com
  • https://*.cdninstagram.com
  • https://*.facebook.com
  • https://*.fbsbx.com

这让我相信他们正在限制网站显示 API 数据。数据本身仍然可以访问,只是不能直接通过网站访问。您需要使用代理或服务器来解决它