Instagram公开用户流API分页失效:max_id参数使用后返回重复内容
Hey, I’ve been dealing with this exact same frustrating issue lately regarding Instagram’s unofficial endpoint https://www.instagram.com/<user>/?__a=1 — their recent JSON format tweak has completely broken the pagination flow that relied on max_id and end_cursor.
The Problem Breakdown
- Previously, the workflow was straightforward: Fetch a public user’s feed, verify
has_next_pagewastrue, then plug the returnedend_cursorinto themax_idparameter for a follow-up request (https://www.instagram.com/<user>/?__a=1&max_id=<end_cursor>) to load older posts. - Now, even though
end_cursorstill shows up in the response andhas_next_pageremainstrue, using thatmax_idparameter just spits back the exact same first page of posts every single time. No new content gets loaded.
Why This Is Happening
This feels like another intentional move from Instagram to clamp down on unofficial API/scraping usage. They’ve kept the old field names (end_cursor, has_next_page) intact so basic feed fetching still works, but they’ve completely changed how the max_id parameter maps to their internal pagination system. It’s a classic "break third-party tools without breaking the core user experience" move.
Possible Workarounds
- Dig deeper into the new JSON structure: Instagram might have hidden the valid pagination token under a different key or nested in a new part of the response. Look for fields like
after,next_cursor, or other pagination-related strings that aren’t the familiarend_cursor. - Mimic official browser requests: Load the target user’s profile in a desktop browser, scroll down to trigger loading more posts, then check your browser’s dev tools (Network tab) to see what actual API calls Instagram’s own site uses. They’re definitely using a different endpoint or parameter setup now that you can replicate (at least temporarily).
- Switch to official APIs (if possible): The only long-term reliable solution is using Instagram’s official APIs — either the Graph API for business/creator accounts or the Basic Display API for personal accounts. Unofficial endpoints will always be a moving target since Instagram actively works to block them.
Important reminder: Using unofficial Instagram APIs violates their Terms of Service, so proceed with caution if you choose to go that route.
内容的提问来源于stack exchange,提问作者Francisc0

