Quick Start
- Download User Data from Instagram
- Retrieve Data from Insta via email
- Locate Following and Followers file
- Run Script
- Code Below
Download User Data
To access your user data from instagram, please go to Instagram.com, and log into your account. Follow the order below :
☰ → Settings → Privacy and Security → Data Download → Request Download
Once here it will give you the option to download your data as either an HTML or a JSON file. For our python code to work properly, please select JSON and then hit next and enter your password to send data.
Retrieve Data from Insta via email
When email is recieved, please select download information to the desired loaction on your computer.
Next locate the file within your downloads.
Locate Following and Followers file
Follow the path with the given folder to find your Followers.json and Following.json file.
From here we need to add these two files to a folder that contains our main.py file.
Run Script
Once the files are located within the correct folder with our python script all the is needed to do is run your python script. Enter the terminal, locate the directory and run python main.py
. This will return the list of people who you are following who do not follow you back.
Enjoy! Thank you for reading!
Code :
import json
# get information from followers file
with open('followers.json') as f:
follower = json.load(f)
# get information from following file
with open('following.json') as g:
following = json.load(g)
followers_list = []
following_list = []
for i in follower['relationships_followers']:
followers_list.append(i['string_list_data'][0]['value'])
for i in following['relationships_following']:
following_list.append(i['string_list_data'][0]['value'])
followers_list.sort()
following_list.sort()
print(len(followers_list), len(following_list))
please_unfollow = []
for _ in range(len(following_list)):
if following_list[_] not in followers_list:
please_unfollow.append(following_list[_])
for _ in range(len(please_unfollow)):
print(please_unfollow[_])
exit()
for _ in range(len(please_unfollow)):
curr = check(please_unfollow[_])
print(curr)
if ',' in curr:
curr = curr.replace(',', '')
elif 'K' in curr:
please_unfollow[_] = 'official_account'
continue
elif 'M' in curr:
please_unfollow[_] = 'official_account'
continue
# Check if user is "official" aka a professional account adjust if needed.
if int(curr) >= 2000:
please_unfollow[_] = 'official_account'
print(curr)
# remove all occurences of 'official_account' in please_unfollow
while 'official_account' in please_unfollow:
please_unfollow.remove('official_account')
print(please_unfollow)
Top comments (0)