一份用于保存Quake搜索结果的脚本
需切换至列表模式使用,只导出 IP、端口、协议
function downloadTextFile(text, fileName) { var element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); element.setAttribute('download', fileName); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); } var row = document.querySelectorAll("tr.el-table__row"); var links = [],ports = [],protocols = []; for (var i = 0 ; i < row.length; i++) { var link = row[i].querySelector("span.table-link").innerText.trim(); if (link.length != 0){links.push(link);} var port = row[i].querySelectorAll("span.cursor-pointer")[0].innerText.trim().split(' ')[0]; if (port.length != 0){ports.push(port);} var protocol = row[i].querySelectorAll("span.cursor-pointer")[1].innerText.trim().replace('http/ssl','https'); if (protocol.length != 0){protocols.push(protocol);} } var text = ''; for (var i = 0;i <links.length; i++){ text = text + links[i]+ '\t' + ports[i] + '\t' + protocols[i] + '\n'; console.log(text); } var fileName = 'data.txt'; downloadTextFile(text, fileName);