You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在fetch中正确传递会话Cookie?Instagram API变更咨询

Hey everyone,

I wanted to flag some important recent changes to Instagram's ?__a=1 API endpoint that I've been troubleshooting firsthand:

Key Updates to Instagram's ?__a=1 Endpoint
  • max_id Parameter No Longer Supported: As part of major API overhauls, the ?__a=1 URL endpoint has dropped support for the max_id parameter entirely.
  • Cookie Requirement (With a Temporary Exception): Officially, valid authenticated cookies are now required to make successful calls to this endpoint. But here's a critical observation: as of April 12, 2018, 4 PM GMT+1, I've verified that requests still work without cookies. I’d strongly recommend testing this in private/incognito browsing mode to confirm the current behavior for yourself.
  • Script Adjustment: To prepare for when the cookie requirement is fully enforced, I modified my script to extract necessary cookie values after logging into Instagram via a browser. Here’s a snippet of the updated code:
# Example authenticated request snippet
import requests

# Replace with your actual cookie values from a logged-in Instagram session
auth_headers = {
    'Cookie': 'sessionid=your_valid_session_id; csrftoken=your_csrf_token'
}

# Make the authenticated API call
response = requests.get('https://www.instagram.com/target_account/?__a=1', headers=auth_headers)
data = response.json()

内容的提问来源于stack exchange,提问作者orbitalz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 03:51:06