Skip to content

feat: add opt-in last-post age badge per account - #303

Open
notluquis wants to merge 2 commits into
davidarroyo1234:masterfrom
notluquis:feat/last-post-age-badge
Open

notluquis wants to merge 2 commits into
davidarroyo1234:masterfrom
notluquis:feat/last-post-age-badge

Conversation

@notluquis

@notluquis notluquis commented Jun 17, 2026 •

Copy link
Copy Markdown

About

Adds an optional "last post age" badge to each account in the scan results (e.g. last post 8mo ago), so inactive accounts are easy to spot when deciding who to unfollow. Touches the same intent as #203/#237 (more per-account context) without the request-volume cost of fetching for everyone.

The feature is off by default — existing behavior is unchanged unless you enable it in Settings.

How it works (block-safety first)

The last-post data is not in the scan payload, so it needs one extra request per account. To keep that from triggering Instagram rate limits:

  • Opt-in, off by default.
  • Gated to idle: fetches only run when the scan is finished or paused, so they never compete with the scan's own request budget.
  • Serial + throttled: one request at a time, randomized 2–4s gap.
  • Cached by user id in localStorage — an account is fetched at most once, ever.
  • Manual mode → fetch only accounts you click. Auto mode → fetch only cards that scroll into view (IntersectionObserver, capped to the 50/page visible).

Endpoint: GET /api/v1/feed/user/{id}/?count=3 with x-ig-app-id, keyed by the numeric user id already available from the scan. We take the max taken_at across the few returned items so a pinned-older post can't win, and only render a /p/<code> link when the item exposes a real shortcode.

Note: this replaced an earlier attempt against web_profile_info, which no longer returns post nodes (only a count with empty edges).

Settings

New section in the Settings menu: a "Show last-post age" toggle and a Manual / Auto radio, with a note that it only fetches when idle.

Resilience

Per-account try/catch isolation in the queue (a poison account or a localStorage quota error can't kill the batch) plus tagged diagnostic logs (lastpost.*) for anomalous responses.

Notes

🤖 Generated with Claude Code

Show how old each scanned account's most recent post is, to help spot
inactive accounts worth unfollowing. Off by default.

Block-safety:
- only fetches when the scan is finished or paused (never competes with
  the scan's request budget)
- serial throttled queue (one request at a time, 2-4s jitter)
- cached by user id in localStorage (each account fetched at most once)
- manual mode (fetch on click) or auto mode (fetch when a card scrolls
  into view, capped to the visible page)

Uses the public web_profile_info endpoint (the same call IG web makes on
a profile visit). Per-item try/catch isolation + tagged diagnostic logs
so one poison account can't kill the queue and the unverified response
shape can be inspected on first repro.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@notluquis
notluquis marked this pull request as ready for review June 17, 2026 20:48
web_profile_info no longer returns post nodes (edge_owner_to_timeline_media
comes back with a count but empty edges), so every account resolved to
"no posts". Switch to /api/v1/feed/user/{id}?count=3, which returns real
items with taken_at + code. Keyed by the numeric user id we already have
from the scan (no username->id round trip), take the max timestamp across
the few items so a pinned-older post can't win, and only render a post link
when the code matches a real shortcode (some items expose a long internal
code).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@davidarroyo1234

Copy link
Copy Markdown
Owner

I will take a look asap

This branch has not been deployed

No deployments
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.

2 participants