关于Instagram接口更新及媒体评论端点变更的技术咨询
Hey there, I’ve been dealing with exactly this Instagram scraping issue lately, so let me break down what I’ve figured out:
Instagram API Endpoint Changes & Mandatory Authentication Requirements
- Non-negotiable rule now: Ever since the Cambridge Analytica incident fallout, Instagram has locked down all its endpoints—every single request has to be authenticated with a logged-in user session. No more anonymous scraping; you need to attach valid session cookies to your request headers.
- Comment endpoint specific changes:
- Old (now invalid) media comment endpoint:
https://www.instagram.com/graphql/query/?query_id=17888483320059182&id={0}&first=100&after={1} - New endpoint details: Instagram revised the GraphQL endpoint structure, and the key addition is that you must include your logged-in
cookie(containingsessionidand other critical auth tokens) in the request headers. Also, thequery_idvalue might have changed—your best bet is to capture a live request from a logged-in browser to get the current validquery_idand full endpoint path.
- Old (now invalid) media comment endpoint:
Quick Practical Tips
- To get a valid session: Use tools like Selenium or Playwright to simulate a manual Instagram login, then save the resulting cookies. Attach these cookies to every subsequent scraping request.
- Anti-scraping heads-up: Instagram’s bot detection is tough—pace your requests like a real user, avoid bulk scraping, and regularly refresh your session if you start getting blocked. Also,
query_idcan get updated without warning, so double-check it periodically by re-capturing a browser request.
内容的提问来源于stack exchange,提问作者supernova
相关产品推荐
相关产品推荐

