// ==UserScript== // @name QQ群群员数据导出 // @namespace None // @version 0.4 // @description 导出QQ群群员名称,QQ号等相关数据 // @author None // @match https://qun.qq.com/member.html // @grant none // @run-at document-end // ==/UserScript== (function() { var scrollInterval, groupSize, exportButton; exportButton = document.createElement('button'); exportButton.innerHTML = '导出成员'; exportButton.id = "exportFile"; exportButton.style = "background-color: red;"; setInterval(addExportButton, 200); function addExportButton() { if (document.getElementById("exportFile") === null) { document.getElementById("groupMemberTit").appendChild(exportButton); document.querySelector('#exportFile').addEventListener('click', startExporting); } } function startExporting() { if (document.getElementById("groupSelectResult").className.split(" ").includes("hide")) { // 全部群员 groupSize = document.getElementById("groupMemberNum").innerHTML; } else { // 筛选过的群员 groupSize = parseInt(document.getElementById("groupSelectResult").innerText.match("[0-9]+")[0]); } if (groupSize == 0) { alert("成员数为0,无法导出"); } else { scrollInterval = setInterval(scroll, 200); } } function scroll() { // 加载全部 var membersInfo = document.getElementById("groupMember").getElementsByTagName("tr"); var noOfLastMember = membersInfo[membersInfo.length - 1].getElementsByTagName("td")[1].innerHTML; scrollBy(0, 500); if (groupSize == noOfLastMember) { clearInterval(scrollInterval); scrollTo(0, 0); getMemberInfo(); } } function getMemberInfo(){ var inValue = "成员,成员类别,群名片,QQ号,性别,Q龄,入群时间,等级(积分),最后发言,\n"; var allMembersInfo = document.getElementById("groupMember").getElementsByTagName("tr"); for (var i=1; i