Skip to content

Instantly share code, notes, and snippets.

@vital-edu
Created August 30, 2021 23:46
Show Gist options
  • Save vital-edu/fb204f97d772392893de4124943bd599 to your computer and use it in GitHub Desktop.
Save vital-edu/fb204f97d772392893de4124943bd599 to your computer and use it in GitHub Desktop.
Script used on Twitter to add person to a list and unfollow them
// This script muust be used in a twitter profile's page to add someone to a list named `listName` and unfollow the person.
let listName = "Flutter" // change this variable value to specify the list's name to where the person will be added to.
let moreBtn = document.querySelector('div[role=button][aria-haspopup=menu][data-testid=userActions]')
moreBtn.click()
let addMemberBtn = document.querySelector('a[href="/i/lists/add_member"]>div')
addMemberBtn.click()
setTimeout(() => {
let allLists = Array.from(document.querySelectorAll('[data-testid=listCell]'))
let listToAddBtn = allLists.find((e) => e.textContent === listName)
listToAddBtn.click()
let saveBtn = Array.from(document.querySelectorAll('span')).find((e) => e.textContent === "Save")
saveBtn.click()
let unfollowBtn = document.querySelector('[data-testid="placementTracking"]').querySelector('span')
unfollowBtn.click()
let confirmUnfollowBtn = document.querySelector('[data-testid="confirmationSheetConfirm"]').querySelector('span')
confirmUnfollowBtn.click()
}, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment