Instagram Mention Parsing: 53 False Handles Found

Summary

Pixel shares an analysis of Instagram caption parsing across 281 posts from six major accounts. It found 53 of 307 extracted mentions were invalid because a trailing period was mistaken for part of a username; checking handles against the source API confirmed all 20 distinct values were invalid as written. The lesson: validate derived fields before relying on them for filtering and analysis.

DEV Community

53 of My 307 Instagram @mentions Ended in a Full Stop. The Accounts I Was Actually Missing Were in Another Field

I run a visa agency in Bali, and the other half of my week goes into Apify Actors. One of them takes Instagram handles and returns one row per post: author, caption, likes, comments, play count, media link, location — plus two convenience fields parsed out of the caption, hashtags and mentions. Those two are the fields buyers actually filter and group on — nobody pivots a spreadsheet on a 2,000-character caption. Which is exactly why I had never checked them. A derived column looks finished the moment it is not empty. The panel Four pages of posts each from natgeo, nike, nasa, disneyplus, jimmychin and natgeotravel, read on 16 November 2026: 281 distinct posts — not handpicked oddities, just the newest posts of six large accounts. Across them the caption regex produced 307 mention values on 159 posts. 53 of the 307 are not usernames Sorted by how often they appeared: Value in mentions Posts hulu. 15 rolex. 12 disneyplus. 6 joelsartore. 3 natgeotv. 2 15 more, once each 15 Twenty distinct values, 53 occurrences, 39 of the 281 posts affected. Every one of them ends in a period, and the reason is boring: the mention ended a sentence. …now streaming on @DisneyPlus and @Hulu. The caption parser takes a run of characters that are legal in an Instagram username, and a period is legal in one — natgeo.travel would be a perfectly good handle — so you cannot simply drop periods from the character class. What you can do is check the other end of the rule. I asked the upstream Instagram source to resolve all 20 values, then the same 20 with the trailing period removed: GET /v1/user/by/username?username=hulu.
400 {"detail":"Invalid username: 'hulu.'","exc_type":"ValidationError"}

GET /v1/user/by/username?username=hulu
200 {"username":"hulu","pk":191074609,"follower_count":3285081,…}
20 of 20 rejected as invalid. 20 of 20 alive once the period came off. An Instagram username may contain periods but may not end with one, and that single rule covers every broken value in the sample. There is also a quieter version of the same bug. In four posts the stripped name was also in the list on its own: "mentions": ["joelsartore", "joelsartore.", "sanantoniozoo."]
One account, two rows in your group-by. Anyone counting "how many posts mention @joelsartore" gets the right answer and the wrong total in the same query. The trap in the obvious fix The obvious fix is "strip trailing punctuation". Do not. The same sample contains camhicks_ and kevinpages_, which look equally mangled: GET /v1/user/by/username?username=camhicks_ → 200, 54,148 followers
Trailing underscores are legal and those are real people. The cleanup has to know the rule, not pattern-match on "looks like punctuation". Mine now strips trailing periods only, lower-cases, and de-duplicates — 307 values became 303, and none of them end in a period. The expensive part: the caption is not the guest list While I had the raw payloads open, I compared what the caption claims to what the rest of the answer contains. Instagram's post object has a field called coauthor_producers — the accounts a collab post is jointly published to, the ones you see under the author's name in the app. Posts with at least one co-author 170 of 281 …where a co-author is not named in the caption 151 …where the caption mentions nobody at all 86 Eighty-six posts came out of my Actor with "mentions": [] while Instagram's own answer listed up to five accounts attached to them. One example, a natgeo reel from 7 November: caption mentions : bertiegregory, disneyplus, hulu.
coauthor_producers: disneyplus, natgeoanimals, natgeotv, bertiegregory
natgeoanimals and natgeotv are co-publishers of that post and appeared in no column of my table. Ranked by how often they were missed: disneyplus 22 times, disneystudios 14, hulu 14, nasa 13, natgeo 12, nikebasketball 12 — exactly the partners anyone doing brand-collaboration research is paying to find. And there is a third place. usertags.in holds the accounts tagged in the image...
Instagram Mention Parsing: 53 False Handles Found
Powered by Readybot.io

The latest from Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …