Get profile data from GraphQL instead of web_profile_info - #328
Conversation
The web_profile_info endpoint now responds with 429 (HTML) even on a clean install, so profile data can no longer be fetched from it. Instagram's own web client loads profile data through GraphQL (PolarisProfilePageContentQuery), either preloaded in the page HTML or via an XHR request, using a different shape (follower_count etc.). - Capture profile data from all GraphQL responses made by the page and normalize both the new and the old shape into InstagramUser - Parse the page's embedded <script type="application/json"> preload data properly instead of scraping raw HTML lines - Wait up to 10 s for an in-flight GraphQL request after page load - Keep the web_profile_info request only as a last resort Fixes #326 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BFDJvmX31k6Xd82sRL7meF
|
@mifi Hello, I ran version 1.11.15 again on macOS 26.6.2 on a Mac mini M4. I performed the tests in the same way as last time: a clean .dmg installation. The application does not create the user’s .json files, so I created them manually afterward. The test result is always the same: Failed to run I also performed the tests on Windows using the same version, 1.11.15, with the same results.
|
Instagram's GraphQL endpoint (www.instagram.com/graphql/query) responds with "text/javascript; charset=utf-8", not application/json, so the response listener added in #328 discarded the PolarisProfilePageContentQuery response and the bot fell through to the blocked web_profile_info endpoint (429). - Parse GraphQL responses regardless of content type - Accept a user object anywhere in the response, and don't require is_verified - Log diagnostics (GraphQL queries seen, their status/content type, and whether the page HTML contained profile data) when user data cannot be found, so bug reports show where it fails - Add unit tests based on a real PolarisProfilePageContentQuery response Fixes #326 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BFDJvmX31k6Xd82sRL7meF
|
check newest version. |
|
@mifi Hello, testing version 1.11.16. So far, everything is working fine with no errors. I’ll have to wait 667.22 seconds. |
|
@mifi Well, after waiting all this time, I’ll let you know the result tomorrow. I’m sending you the log I have so far. 2:45 AMNo cookies found
|
|
@mifi Hi, I’ve been testing the application. It doesn’t show any errors, but it doesn’t work. The followed and unfollowed JSON files are still empty, both containing just []. The Instagram interface only appears when the timeout finishes. It stays visible for 3–4 seconds and then goes back to this:"data":{"user":{"edge_followed_by":{"count":387,"page_info":{"has_next_page":false,"end_cursor":null},"edges":[]}}},"extensions":{"is_final":true,"server_metadata":{"request_start_time_ms":1789459139309,"time_at_flush_ms":1789459139348}},"status":"ok"}"
|




Fixes #326 (follow-up to #324 / #325, related to #312)
Problem
After #325 the error became readable, and #326 shows what it actually is:
web_profile_info responded with status 429 (text/html)on a clean install, on the very first profile. That endpoint is now blocked by Instagram rather than rate limited, so the bot can no longer get profile data (follower counts, private/verified flags, user id) from it.Change
Instagram's own web client loads profile data through GraphQL (
PolarisProfilePageContentQuery), either preloaded in the page HTML or via an XHR request, using a different shape (follower_count,following_count,is_business,hd_profile_pic_url_info,category).page.on('response')listener that captures profile data from every GraphQL response the page makes, and a normalizer that converts both the new shape and the oldweb_profile_infoshape into the existingInstagramUsertype.<script type="application/json">preload blocks properly (instead of scraping raw HTML lines), including the stringified-response form the old code handled.web_profile_infoas a last resort.Testing
tscandeslintpass.data.userkey withfollower_count/following_count. If it does not, the log shows "Waiting for user data from GraphQL request" and then falls through to the previous 429 error.🤖 Generated with Claude Code
https://claude.ai/code/session_01BFDJvmX31k6Xd82sRL7meF
Generated by Claude Code