Skip to content

Fix GraphQL profile responses being ignored due to content type - #329

Merged
mifi merged 2 commits into
masterfrom
claude/nifty-mayer-0ihhb3
Sep 14, 2026
Merged

mifi merged 2 commits into
masterfrom
claude/nifty-mayer-0ihhb3

Conversation

@mifi

@mifi mifi commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Fixes #326 (follow-up to #328, which shipped in 1.11.15 but still failed with the same 429 error)

Root cause

Instagram's GraphQL endpoint (www.instagram.com/graphql/query) responds with content-type: text/javascript; charset=utf-8, not application/json. The response listener added in #328 only parsed responses whose content type contained "json", so the PolarisProfilePageContentQuery response carrying the profile data was discarded, and the bot fell through to the blocked web_profile_info endpoint. Confirmed from a real captured request/response.

Changes

  • Parse GraphQL responses regardless of content type.
  • Accept a user object anywhere in the response (not only under a user key), and don't require is_verified.
  • When user data can't be found, log diagnostics before the last resort: the GraphQL queries seen for that page (friendly name, status, content type, whether a user was found) and how many embedded page JSON scripts contained profile data. Future reports will show exactly where it fails.
  • Wrap the last-resort error as Could not get user data for <username> (...).
  • Move user data parsing into packages/instauto/src/userData.ts and add unit tests based on a real PolarisProfilePageContentQuery response (plus the old shape, relay preload cache, streamed responses). The instauto test script now runs them (node --test); test files are excluded from the build.

Testing

  • tsc, eslint, yarn workspace instauto build and yarn workspace instauto test (7 tests) pass.
  • Not run against the live site from this environment; the parsing is verified against the captured response, and the listener change removes the exact filter that dropped it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BFDJvmX31k6Xd82sRL7meF


Generated by Claude Code

Pure code move, no behavior change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFDJvmX31k6Xd82sRL7meF
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
@mifi
mifi force-pushed the claude/nifty-mayer-0ihhb3 branch from 4477d00 to c0ef30f Compare September 14, 2026 20:54
@mifi
mifi merged commit a58660f into master Sep 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: web_profile_info responded with status 429 (text/html; charset=utf-8)

2 participants