一鍵屏蔽微博監督員的腳本實操

FreeBashulia
Oct 13, 2017 · 3 min read

使用方式

  1. 打开 Chrome 浏览器。
  2. 打开网址:http://weibo.com/p/1006066264005608/follow
  3. 在 粉丝列表页 打开 Chrome 开发人员工具(Windows:F12 / Mac:忘记了),并切换到 Console 面板。
  4. 复制 main.js中的全部内容(以下加粗部分),粘贴到 Console,回车。

function crawl(){ if(1 != document.querySelector(“.page.S_bg1”).innerText){ console.error(“请先手动跳转到粉丝列表的第一页后再次执行此脚本!”); return; } var result = “”; var page = 1; var count = 0; var timer = setInterval(function(){ if(page != document.querySelector(“.page.S_bg1”).innerText){ return; } console.log(“正在采集第 “+page+” 页…”); page++; var list = document.querySelectorAll(“.icon_supervisor”); for(var i = 0; i < list.length;i++){ var item = list[i].parentNode.childNodes[1]; var usercard = item.attributes[“usercard”].value; var uid = usercard.match(/id=\d+/)[0].match(/\d+/)[0]; result += uid + “\n”; count++; } console.log(“第 “+page+” 页采集完毕。”); if(page < 6){ document.querySelector(“.page.next”).click(); }else{ clearInterval(timer); console.info(“采集完毕,共获取到 uid “+count +” 个:\n”+result); } },1000);} crawl();

5. 等待数秒,采集完成。

問題反饋:

1、提示:失敗

微博在某些瀏覽器默認是http非安全方式連接,所以如果你的瀏覽器如上圖,顯示嘆號,則須手動以https的方式重新訪問(如下圖):

然後再按步驟操作:

成功。

2、這是一個JSP批處理腳本,因為監督員的名單是變動的,所以不能保證全部包括,大家可以隨時手動添加、更新名單。

感謝原腳本作者!

https://github.com/overtrue/weibo-dogs-killer

FreeBashulia

Written by

Bashulia patriot, warrior, brave man, Support and Fighting for Cathaysians independence, and dismember 'China' and build a system of mutual security. 巴蜀利亞愛國者,戰士

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade