Skip to content

Instantly share code, notes, and snippets.

@TimoReusch
Created January 31, 2024 02:01
Show Gist options
  • Save TimoReusch/b592e54cad684c7defad579fcab4a71f to your computer and use it in GitHub Desktop.
Save TimoReusch/b592e54cad684c7defad579fcab4a71f to your computer and use it in GitHub Desktop.
Compares the exported JSON files from Instagram and TikTok and shows you who you follow on TikTok, but not on Instagram and vice versa.
import json
with open('tiktok-follows.json', 'r') as f:
tiktok = json.load(f)
with open('insta-follows.json', 'r') as f:
insta = json.load(f)
tiktok_follows = []
for follow in tiktok:
tiktok_follows.append(follow["UserName"])
insta_follows = []
for follow in insta:
insta_follows.append(follow["string_list_data"][0]["value"])
# Convert lists to sets
set_Insta = set(insta_follows)
set_TikTok = set(tiktok_follows)
# Find elements in T but not in I
T_not_I = set_TikTok - set_Insta
T_not_I = sorted(T_not_I)
print("Elements in TikTok but not in Insta: ")
print("-------------------------------")
for e in T_not_I:
print(f"- [ ] {e}")
print()
# Find elements in I but not in T
I_not_T = set_Insta - set_TikTok
I_not_T = sorted(I_not_T)
print("Elements in Instagram but not in TikTok")
print("-------------------------------")
for e in I_not_T:
print(f"- [ ] {e}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment