Last active
January 20, 2026 01:57
-
-
Save vittau/a65c5ee99e28d44c98b2bc219e8d3b93 to your computer and use it in GitHub Desktop.
Users who don't follow back on Instagram (use exported data as JSON)
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
| const fs = require("fs"); | |
| // Function to read JSON files | |
| function readJsonFile(filePath) { | |
| return new Promise((resolve, reject) => { | |
| fs.readFile(filePath, "utf8", (err, data) => { | |
| if (err) { | |
| reject(err); | |
| } else { | |
| resolve(JSON.parse(data)); | |
| } | |
| }); | |
| }); | |
| } | |
| // Function to find the set difference | |
| function findSetDifference(following, followers) { | |
| const followingSet = new Set(following); | |
| const followersSet = new Set(followers); | |
| return followingSet.difference(followersSet); | |
| } | |
| // Main function to read files and print the set difference | |
| async function main() { | |
| try { | |
| const fileFollowing = (await readJsonFile("following.json")).relationships_following; | |
| const fileFollowers = await readJsonFile("followers_1.json"); | |
| const following = fileFollowing.map((i) => i.title); | |
| const followers = fileFollowers.map((i) => i.string_list_data[0].value); | |
| const difference = findSetDifference(following, followers); | |
| const arr = Array.from(difference); | |
| const filtered = fileFollowing.filter((item) => arr.find((i) => item.title === i)); | |
| filtered.sort((a, b) => b.string_list_data[0].timestamp - a.string_list_data[0].timestamp); | |
| console.log('People in "following" not in "followers":\n'); | |
| filtered.forEach((item) => { | |
| const date = new Date(item.string_list_data[0].timestamp * 1000); | |
| const dateLocale = date.toLocaleDateString("pt-BR"); | |
| const link = `https://www.instagram.com/${item.title}`; | |
| console.log(`${dateLocale} -> ${link}`); | |
| }); | |
| } catch (error) { | |
| console.error("Error reading files:", error); | |
| } | |
| } | |
| main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment