(async () => {
const username = "Luca_cettolin"; // tu user fijo
// 1. Buscar userId de tu perfil
const profileRes = await
fetch(`https://i.instagram.com/api/v1/users/web_profile_info/?username=$
{username}`, {
headers: {
"x-ig-app-id": "936619743392459" // App ID pública de Instagram Web
},
credentials: "include"
});
const text = await profileRes.text();
let profileData;
try {
profileData = JSON.parse(text);
} catch (e) {
console.error("⚠️ No pude parsear JSON. Respuesta fue:", text);
alert("Error al obtener tu perfil. Mirá la consola.");
return;
}
const userId = profileData.data.user.id;
console.log("✅ Tu userId es:", userId);
// 2. Función genérica para traer listas
async function getUsers(hash, edge) {
let users = [], endCursor = null, hasNextPage = true;
while (hasNextPage) {
const url = `https://www.instagram.com/graphql/query/?query_hash=$
{hash}&variables=${encodeURIComponent(JSON.stringify({
id: userId,
include_reel: true,
fetch_mutual: true,
first: 50,
after: endCursor
}))}`;
const res = await fetch(url, { credentials: "include" });
const txt = await res.text();
let data;
try {
data = JSON.parse(txt);
} catch {
console.error("⚠️ No pude parsear JSON en getUsers. Respuesta fue:", txt);
break;
}
const edgeObj = data.data.user[edge];
users = users.concat(edgeObj.edges.map(e => e.node));
hasNextPage = edgeObj.page_info.has_next_page;
endCursor = edgeObj.page_info.end_cursor;
}
return users;
}
// 3. Obtener seguidos/seguidores
console.log("⏳ Obteniendo seguidos...");
const following = await getUsers("3dec7e2c57367ef3da3d987d89f9dbc8",
"edge_follow");
console.log("⏳ Obteniendo seguidores...");
const followers = await getUsers("c76146de99bb02f6415203be841dd25a",
"edge_followed_by");
// 4. Comparar
const followersSet = new Set(followers.map(u => u.username));
const notFollowingBack = following.filter(u => !followersSet.has(u.username));
console.log("🚫 Usuarios que NO te siguen de vuelta:");
console.table(notFollowingBack.map(u => ({ username: u.username, full_name:
u.full_name })));
const list = notFollowingBack.map(u => u.username).join("\n");
await navigator.clipboard.writeText(list);
alert(`✅ ${notFollowingBack.length} usuarios no te siguen. Lista copiada al
portapapeles.`);
})();