instagram/user: feed/user redirects to HTML shell, web_profile_info fallback returns 429
- Dominant language
- JavaScript
- Stars
- 29.3k
- Forks
- 2.9k
- Avg merge
- 15h 36m
- Merged PRs (30d)
- 70
Description
## Summary
`opencli instagram user ` fails with a JSON parse error because both REST endpoints the adapter relies on no longer return post JSON. This was diagnosed via the `opencli-autofix` skill but **not fixed** — filing as a bug report for a maintainer to pick up, since a real fix likely needs Instagram's current internal GraphQL persisted-query shape.
## Adapter
- Site: `instagram`
- Command: `user`
- File: `clis/instagram/user.js`
- OpenCLI version: 1.8.7
## Observed failure
```
SyntaxError: Unexpected token '<', "/username/?count=
```
Reproduced this exact call inside a logged-in session (opencli browser): it now returns `200 OK` but `redirected: true`, with `finalUrl: https://www.instagram.com/` and an HTML app-shell body (`...`) instead of JSON. Since `response.ok` is `true` for a redirected 200, the adapter's `if (!r2.ok) throw ...` guard doesn't catch it, and `r2.json()` throws.
This is 100% reproducible (not rate limiting) — repeated calls consistently redirect to the homepage.
## Fallback endpoint also broken
The code comment notes `web_profile_info` was avoided because it's "gated for some public accounts." I tested it as a possible fix:
```
GET https://www.instagram.com/api/v1/users/web_profile_info/?username=
```
with `X-IG-App-ID`, `X-CSRFToken`, and `X-ASBD-ID` headers, from an authenticated session. It returns `429` with an HTML "Página no encontrada" block page — reproducible for both the target account and an unrelated well-known public account (`instagram`), so it's not account-specific gating.
## What I checked before ruling this an adapter/API-shape issue (not auth or transient blocking)
- `opencli doctor`: daemon + extension connected, no issues.
- Confirmed logged-in session in the controlled browser (nav showed `/direct/inbox/` and the account's own profile link).
- Waited between probes and retried — `feed/user` redirect is consistent, not a one-off rate-limit blip.
- Checked the initial profile page HTML (`instagram.com//`) for embedded post data (the old `edge_owner_to_timeline_media` GraphQL shape): not present. Post/timeline data now appears to live inside Meta's internal Relay/`__bbox` bundle format and/or is fetched via authenticated persisted-query GraphQL (`POST /api/graphql`) calls that weren't straightforward to capture with a `doc_id` — a real fix likely needs reverse-engineering that persisted query, which is beyond a simple selector/endpoint swap.
## Suggested next step
Full adapter rewrite around the current GraphQL persisted-query call Instagram's own web client uses for profile timelines (via `opencli browser network` while manually scrolling a profile page), rather than patching the old REST paths.
_Filed via the `opencli-autofix` skill after diagnosis; no local fix was verified, so none is claimed here._
Contributor guide
Research direction
Start in clis/instagram/user.js and reproduce the failing feed/user request, then use `opencli browser network` while scrolling an Instagram profile to inspect the current authenticated GraphQL calls. Compare the captured persisted-query shape with the adapter's existing endpoints; done means the user command retrieves profile posts without redirect HTML or JSON parse errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, javascript
- Domain
- backend-api-design, cli
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100