You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: inner circle algorithm and interaction affinity ranking - #2708
Mutual follows are computed from get_followers(limit=50) and get_followings(limit=50), i.e. the intersection of two 50-account samples. For most real accounts most mutuals will be missed, and is_following_target / is_followed_by_target will be False just because the account isn't in the sample. Please flag the result as partial when the sample is truncated (compare with the follower/following counts), or don't show those flags in that case.
Comments are +1.5 each with no cap, so an account that comments six times (a bot, a fan, or a troll) reaches the "Core Confidant" tier. Please cap the contribution per post (e.g. count each post once, or use diminishing returns), and consider ignoring comments that are clearly hostile or spam.
The mention regex @([A-Za-z0-9_.]+) captures the trailing period ("thanks @mario." gives mario.) and the domain of emails (a@b.com gives b.com). Please strip the trailing dots and skip matches preceded by a word character.
The three except Exception: pass blocks hide failures (e.g. 429s) and the result looks complete. Please reuse the existing partial_warning mechanism, or return the error.
Naming and framing
"Core Confidant" and "Close Friend" claim a personal relationship that interaction counts can't support, and an account with only a mutual follow (3.5, no interaction) ends up as "Frequent Contact". Please use neutral labels (e.g. High / Medium / Low interaction) and add a short disclaimer in the UI and in doc/web-ui.md: "interaction indicator, not evidence of a relationship".
Cost
Each run makes about 16 requests (feed, one comments call per post, followers, following), and scan_posts has no upper limit, so the AI tool could ask for 1000 posts. Please cap scan_posts (e.g. 30) server-side, as in #2706.
Tests
Please add tests for repeated comments from one account, the mention with a trailing period, a failing sub-fetch, and a truncated follower sample.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
When analyzing an Instagram target profile, raw follower or following lists fail to show who the target actually interacts with in real life.
This PR introduces an Inner Circle Algorithm that computes a multi-signal closeness/affinity score between the target and interacting accounts.
Key Changes
src/inner_circle.py):+3.5)+3.0)+1.5)@username) (+2.0)Core Confidant(Affinity score ≥ 8.0)Close Friend(4.0 ≤ Affinity score < 8.0)Frequent Contact(Affinity score < 4.0)src/osint_service.py):get_inner_circle(limit=10, scan_posts=12)toOsintgramService.get_inner_circleinsrc/web/tools.py.src/web/static/index.htmldisplaying rank, profile avatar, tier pill, affinity star rating, and interaction badges (mutuals, tags, comments, mentions).Networkindoc/web-ui.md(31 total commands).tests/test_inner_circle.pycovering scoring weights, tier categorization, target exclusion, service method, private profile guarding, and tool registration.Verification
python -m pytest -q).flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics).