(() => {
if (window.location.hostname !== "www.instagram.com") {
alert("กรุณาเปิด Instagram ก่อนใช้งาน");
location.href = "https://www.instagram.com/";
return;
}
const fetchOptions = {
credentials: "include",
headers: {
"X-IG-App-ID": "936619743392459"
}
};
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
const randomDelay = () =>
Math.floor(Math.random() * 1200) + 800;
const getUserId = async (username) => {
const response = await fetch(
`https://www.instagram.com/api/v1/users/web_profile_info/?username=${username}`,
fetchOptions
);
const data = await response.json();
return data?.data?.user?.id || null;
};
const fetchList = async (type, userId) => {
let users = [];
let next = null;
do {
const url = next
? `https://www.instagram.com/api/v1/friendships/${userId}/${type}/?count=100&max_id=${next}`
: `https://www.instagram.com/api/v1/friendships/${userId}/${type}/?count=100`;
const response = await fetch(url, fetchOptions);
if (!response.ok) {
throw new Error(
`Instagram API Error (${response.status})`
);
}
const data = await response.json();
users.push(...(data.users || []));
console.log(
`📦 โหลด ${type}: ${users.length} คน`
);
next = data.next_max_id;
if (next) {
await sleep(randomDelay());
}
} while (next);
return users;
};
const getFollowers = (id) =>
fetchList("followers", id);
const getFollowing = (id) =>
fetchList("following", id);
const checkUnfollowers = async (username) => {
console.clear();
console.log(
`%c🚀 เริ่มตรวจสอบ: ${username}`,
"font-size:18px;color:#4ade80;font-weight:bold;"
);
const userId = await getUserId(username);
if (!userId) {
throw new Error("ไม่พบ Username");
}
console.log("📥 กำลังโหลด Followers...");
const followers = await getFollowers(userId);
console.log("📥 กำลังโหลด Following...");
const following = await getFollowing(userId);
const followersSet = new Set(
followers.map(u =>
u.username.toLowerCase()
)
);
const notFollowingBack = following.filter(
user =>
!followersSet.has(
user.username.toLowerCase()
)
);
console.clear();
console.log(
`%c📊 ผลการตรวจสอบ`,
"font-size:24px;color:#facc15;font-weight:bold;"
);
console.log("━━━━━━━━━━━━━━━━━━━━━━");
console.log(
`👥 Followers : ${followers.length}`
);
console.log(
`👤 Following : ${following.length}`
);
console.log(
`❌ ไม่ฟอลกลับ : ${notFollowingBack.length}`
);
console.log("━━━━━━━━━━━━━━━━━━━━━━");
if (notFollowingBack.length === 0) {
console.log(
"%c✅ ทุกคนฟอลกลับคุณ",
"color:#4ade80;font-size:18px;"
);
return;
}
console.log(
"%c📋 รายชื่อคนไม่ฟอลกลับ",
"color:#fb7185;font-size:18px;font-weight:bold;"
);
notFollowingBack.forEach((user, index) => {
console.log(
`${index + 1}. https://instagram.com/${user.username}`
);
});
};
const username =
prompt("กรอก Username Instagram:");
if (username) {
checkUnfollowers(username)
.catch(err => {
console.error(
"❌ Error:",
err.message
);
});
}
})();
วิธีใช้งาน
1. กดปุ่ม
คัดลอกสคริปต์
2. เปิด
Instagram.com
3. กด
F12
4. ไปแท็บ
Console
5. วางโค้ดแล้วกด
Enter
6. กรอก Username ที่ต้องการตรวจสอบ
Instagram อาจมีการจำกัด API หรือขึ้น challenge ได้
หากยิง request จำนวนมากเกินไป