Created
May 28, 2019 13:06
-
-
Save asdfMaciej/259e6b03c9b41300ff36300c146b6492 to your computer and use it in GitHub Desktop.
spot and get rid of inactive Instagram followers & see who stopped following
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
""" | |
Usage: | |
scrape the XHR requests manually to files [tedious, but faster for me than implementing a scraper] | |
l01, l02.. etc should contain like requests | |
f1 f2 f3.. etc should contain followers | |
get a better like to follower ratio than ever lmao | |
""" | |
import json | |
from pprint import pprint | |
likes = {} | |
files = ['01', '02', '03', '04', '05', '06', '07', '08', '09'] | |
for i in range(40): | |
if i < 10: | |
continue | |
files.append(str(i)) | |
for fn in files: | |
fname = 'l'+fn | |
with open(fname, 'r') as f: | |
a = json.load(f) | |
for user in a["data"]["shortcode_media"]["edge_liked_by"]["edges"]: | |
username = user["node"]["username"] | |
if username not in likes: | |
likes[username] = 0 | |
likes[username] += 1 | |
follow = [1,2,3,4,5,6] | |
followers = [] | |
for fn in follow: | |
fname = 'f'+str(fn) | |
with open(fname, 'r') as f: | |
a = json.load(f) | |
for user in a["data"]["user"]["edge_followed_by"]["edges"]: | |
username = user["node"]["username"] | |
if username not in followers: | |
followers.append(username) | |
out = "" | |
for follower in followers: | |
if follower in likes: | |
if 1==1:#likes[follower] < 4: | |
print("[*] "+follower+" - "+str(likes[follower])+" likes") | |
else: | |
out += "Get rid of "+follower+"!\n" | |
for user in likes: | |
if user not in followers: | |
print(user + " no longer follows you with past "+str(likes[user])+" likes") | |
print(out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment