Advertisement
hivefans

tw-unfollow.js

Jul 22nd, 2023
1,293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.82 KB | Source Code | 0 0
  1. ////////实现推特批量取消关注的功能. 使用方法:打开网页版推特,进入关注列表,F12打开检查,找到控制台,粘贴进去代码,回车运行(一次只能取关30~70,为了防止被封)
  2. let btns = document.querySelectorAll("[data-testid]")
  3. let followBtns = Array.from(btns).filter(btn => {
  4.     return btn.getAttribute('data-testid').includes('unfollow')
  5.    })      
  6.    for (let i = 1; i <= followBtns.length; i++) {        
  7.       followBtns[i - 1].click();        
  8.       let _span = document.getElementsByTagName('span');        
  9.       for (var j = 0; j < _span.length; j++) {
  10.         if (_span[j].textContent == "取消关注") {                
  11.           _span[j].click();                
  12.           console.log("取关");            
  13.           }        
  14.         }    
  15.      }
Tags: unfollow
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement