Last active
December 27, 2025 02:40
-
-
Save Isopach/8c204be8eff3c0efdfcb81d4196f9ab5 to your computer and use it in GitHub Desktop.
Check Instagram Follows who don't follow back
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
| #!/usr/bin/env python3 | |
| """ | |
| 1. Go to https://accountscenter.instagram.com/info_and_permissions/dyi/ | |
| 2. Select 'Request Download' | |
| 3. Select Followers & Following | |
| 4. Select 'All time' (default is 'Last Year') | |
| 5. Select 'Json' (default is 'HTML') | |
| 6. Download the data | |
| 7. Unzip and put this file into the same directory | |
| 8. Change your follower/following count to match your instagram numbers | |
| USAGE: python3 diff.py | |
| """ | |
| import json | |
| def extract_users(json_data, filename): | |
| users = set() | |
| data_list = [] | |
| # --- Step 1: Normalize structure (List vs Dict) --- | |
| if isinstance(json_data, dict): | |
| if "relationships_following" in json_data: | |
| data_list = json_data["relationships_following"] | |
| elif "relationships_followers" in json_data: | |
| data_list = json_data["relationships_followers"] | |
| elif isinstance(json_data, list): | |
| data_list = json_data | |
| # --- Step 2: Extract usernames --- | |
| for entry in data_list: | |
| try: | |
| # CASE A: 'following.json' style (Username is in 'title') | |
| # We must check if title is NOT empty, because followers.json has empty titles. | |
| if 'title' in entry and entry['title']: | |
| users.add(entry['title']) | |
| # CASE B: 'followers.json' style (Username is in 'string_list_data' -> 'value') | |
| elif 'string_list_data' in entry and len(entry['string_list_data']) > 0: | |
| item = entry['string_list_data'][0] | |
| if 'value' in item: | |
| users.add(item['value']) | |
| except (KeyError, IndexError, TypeError): | |
| continue | |
| return users | |
| # --- Main Logic --- | |
| # 1. Load Followers | |
| try: | |
| with open('followers_1.json', 'r') as f: | |
| followers_set = extract_users(json.load(f), "followers_1.json") | |
| except FileNotFoundError: | |
| print("Error: Could not find 'followers_1.json'") | |
| followers_set = set() | |
| # 2. Load Following | |
| try: | |
| with open('following.json', 'r') as f: | |
| following_set = extract_users(json.load(f), "following.json") | |
| except FileNotFoundError: | |
| print("Error: Could not find 'following.json'") | |
| following_set = set() | |
| # 3. Calculate Difference | |
| not_following_back = following_set - followers_set | |
| print(f"--- STATS ---") | |
| print(f"You follow: {len(following_set)}") | |
| print(f"Followers: {len(followers_set)}") | |
| print(f"Not following you back: {len(not_following_back)}") | |
| print(f"------------------------------------------") | |
| # 4. Print Links | |
| if len(not_following_back) > 0: | |
| for user in sorted(list(not_following_back)): | |
| print(f"https://www.instagram.com/{user}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment