Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix: Update Instagram detection logic#2903

Open
Sumit0x00 wants to merge 4 commits into
sherlock-project:masterfrom
Sumit0x00:fix-instagram-detection
Open

Fix: Update Instagram detection logic#2903
Sumit0x00 wants to merge 4 commits into
sherlock-project:masterfrom
Sumit0x00:fix-instagram-detection

Conversation

@Sumit0x00

Copy link
Copy Markdown

This PR fixes the broken Instagram detection which was causing false negatives (existing accounts reported as "Not Found").

Problem

  1. Proxy Blocked: The previous implementation relied on imginn.com, which is currently returning a 403 (Cloudflare challenge) for automated requests.

  2. Soft 404s: Direct probes to instagram.com return a 200 OK status for both existing and non-existing accounts.

  3. UA Sensitivity: Standard desktop User-Agents often lead to a generic login wall, making it impossible to differentiate account existence via HTTP headers.

Solution

  1. Switched to Message Detection: Changed errorType from status_code to message.

  2. Mobile User-Agent: Updated headers to use a Mobile (iPhone) User-Agent. My testing confirmed that Instagram serves unique <title> tags for existing profiles when queried with a mobile UA, even without a session.

  3. Error Patterns: Added detection patterns for non-existent profiles:

  • <title>Instagram</title> (The generic title returned for the "unavailable" page).
  • Profile isn't available.
  1. Clean Up: Removed the non-functional urlProbe (imginn.com).

Verification Results
Tested locally with the --local flag:

  • Existing Account: instagram.com/blamesumit -> Found
  • Non-existent Account: instagram.com/random_handle_123 -> Not Found

@github-actions

Copy link
Copy Markdown
Contributor

Automatic validation of changes

Target F+ Check F- Check
Instagram ❌   Fail ✔️   Pass

Failures were detected on at least one updated target. Commits containing accuracy failures will often not be merged (unless a rationale is provided, such as false negatives due to regional differences).

@Sumit0x00 Sumit0x00 mentioned this pull request Apr 16, 2026
1 task
Comment thread sherlock_project/resources/data.json Outdated
],
"errorType": "message",
"headers": {
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1"

@rskbansal rskbansal May 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting fix! We can try using a new UA since the current one is from 2021 and Instagram may deprioritise or block requests from severely outdated mobile browsers.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. I've updated the User-Agent to a recent iOS/Safari version and pushed the changes to this PR.

I also re-tested the detection locally to confirm that existing and non-existent Instagram profiles are still distinguished correctly. Please let me know if you'd like me to test against any additional scenarios.

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