Skip to content

Instantly share code, notes, and snippets.

@berstend
Last active November 5, 2024 18:46
Show Gist options
  • Save berstend/752e7b54fd0bbd8b672882459d149b60 to your computer and use it in GitHub Desktop.
Save berstend/752e7b54fd0bbd8b672882459d149b60 to your computer and use it in GitHub Desktop.
Mass unfollow users on Instagram (no app needed)
  • Go to your profile on instagram.com (sign in if not already)
  • Click on XXX following for the popup with the users you're following to appear
  • Open Chrome Devtools and Paste the following into the Console and hit return:
(async function(){
  const UNFOLLOW_LIMIT = 800
  const delay = (ms) => new Promise(_ => setTimeout(_, ms))
  const findButton = (txt) => [...document.querySelectorAll("button").entries()].map(([pos, btn]) => btn).filter(btn => btn.innerHTML === txt)[0]

  console.log("Start")
  for (let i = 0; i < UNFOLLOW_LIMIT; i++) {
    const $next = findButton("Following")          
    if (!$next) { continue }
    $next.scrollIntoViewIfNeeded()  
    $next.click()
    await delay(100)
    $confirm = findButton("Unfollow")    
    if ($confirm) {
      $confirm.click()
    }

    await delay(20 * 1000) // Wait 20s, 200 unfollows per hour limit
    console.log(`Unfollowed #${i}`)
  }

  console.log("The end")
})()
@YAGOPORTELAYP
Copy link

YAGOPORTELAYP commented Oct 21, 2024 via email

@je4npw
Copy link

je4npw commented Nov 5, 2024

//for pt_BR users

(async function(){
  const UNFOLLOW_LIMIT = 800
  const delay = (ms) => new Promise(_ => setTimeout(_, ms))
  const findButton = (txt) => [...document.querySelectorAll("button").entries()].map(([pos, btn]) => btn).filter(btn => btn.innerText === txt)[0]

  console.log("Start")
  for (let i = 0; i < UNFOLLOW_LIMIT; i++) {
    const $next = findButton("Seguindo")          
    if (!$next) { continue }
    $next.scrollIntoViewIfNeeded()  
    $next.click()
    await delay(100)
    $confirm = findButton("Deixar de seguir")    
    if ($confirm) {
      $confirm.click()
    }

    await delay(20 * 1000) // Aguarde 20s, 200 unfollows é o limite por hora
    console.log(`Unfollowed #${i}`)
  }

  console.log("Fim")
})()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment