Created
January 31, 2024 02:01
-
-
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.
This file contains 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
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