## Step 1: Fetch UserID. ```javascript! https://www.instagram.com/web/search/topsearch/?query=Enter_Usename ``` ## Step 2: Enter UserId in the script below. ```javascript! ///////////////////////////////// const userId = Enter_UserId_Here ; ///////////////////////////////// let followers = [{ username: "", full_name: "" }]; let followings = [{ username: "", full_name: "" }]; let dontFollowMeBack = [{ username: "", full_name: "" }]; let iDontFollowBack = [{ username: "", full_name: "" }]; var csvData = "username,fullname,type\r\n"; followers = []; followings = []; dontFollowMeBack = []; iDontFollowBack = []; (async () => { try { console.log(`Process started! Give it a couple of seconds`); let after = null; let has_next = true; while (has_next) { await fetch( `https://www.instagram.com/graphql/query/?query_hash=c76146de99bb02f6415203be841dd25a&variables=` + encodeURIComponent( JSON.stringify({ id: userId, include_reel: true, fetch_mutual: true, first: 50, after: after, }) ) ) .then((res) => res.json()) .then((res) => { has_next = res.data.user.edge_followed_by.page_info.has_next_page; after = res.data.user.edge_followed_by.page_info.end_cursor; followers = followers.concat( res.data.user.edge_followed_by.edges.map(({ node }) => { return { username: node.username, full_name: node.full_name, }; }) ); }); } after = null; has_next = true; while (has_next) { await fetch( `https://www.instagram.com/graphql/query/?query_hash=d04b0a864b4b54837c0d870b0e77e076&variables=` + encodeURIComponent( JSON.stringify({ id: userId, include_reel: true, fetch_mutual: true, first: 50, after: after, }) ) ) .then((res) => res.json()) .then((res) => { has_next = res.data.user.edge_follow.page_info.has_next_page; after = res.data.user.edge_follow.page_info.end_cursor; followings = followings.concat( res.data.user.edge_follow.edges.map(({ node }) => { return { username: node.username, full_name: node.full_name, }; }) ); }); } dontFollowMeBack = followings.filter((following) => { return !followers.find( (follower) => follower.username === following.username ); }); iDontFollowBack = followers.filter((follower) => { return !followings.find( (following) => following.username === follower.username ); }); console.clear() console.log( `Process is done: Type 'copy(followers)' or 'copy(followings)' or 'copy(dontFollowMeBack)' or 'copy(iDontFollowBack)' in the console and paste it into a text editor to take a look at it'` ); console.log( '----followers----' ); console.log( followers ); console.log( '----followings----' ); console.log( followings ); console.log( '----iDontFollowBack----' ); console.log( iDontFollowBack); console.log( '----dontFollowMeBack----' ); console.log( dontFollowMeBack ); followers.forEach(follower=> csvData+= '"'+ follower.username +'","' + follower.full_name+'","'+'follower' + '"' +'\r\n') followings.forEach(following=> csvData+='"'+ following.username +'","' + following.full_name+'","'+'following' + '"' +'\r\n') iDontFollowBack.forEach(followthem=> csvData+='"'+ followthem.username +'","' + followthem.full_name+'","'+'iDontFollowBack'+ '"' +'\r\n') dontFollowMeBack.forEach(unfollow=> csvData+='"'+ unfollow.username +'","' + unfollow.full_name+'","'+'dontFollowMeBack'+ '"' +'\r\n') } catch (err) { console.log({ err }); } })(); ``` ## Step 3: Copy and paste csvData ```javascript! copy(csvData) ``` ## Step 4: ༼ つ ◕_◕ ༽つ [Follow us at CyberSpace](https://www.instagram.com/cyberspace.global)