// ==UserScript== // @name 阿里巴巴国际站批量下载访客详情关键词 // @namespace http://tampermonkey.net/ // @version 1.0.1 // @description 在访客详情页面,批量营销按钮后面插入一个下载按钮,点击可以从头开始记录每位访客所有的关键词(页面中看到什么关键词就会记录什么关键词),最终输出成csv文件自动下载,可以选择自动去重版本,把“全收集完后可选数组降维和去重”这一行注释下面的代码注释互换就好。 // @author TuffPlusOM // @match http://*/* // @match https://*/* // @grant GM_addStyle // @downloadURL none // ==/UserScript== 'use strict'; var globalAllresult = []; // 将下边代码粘贴到浏览器的控制台 (function(console){ console.save = function(data, filename){ if(!data) { console.error('Console.save: No data found!') return; } if(!filename) filename = 'console.json' if(typeof data === "object"){ data = JSON.stringify(data, undefined, 4) } var blob = new Blob([data], {type: 'text/json'}), e = document.createEvent('MouseEvents'), a = document.createElement('a') a.download = filename a.href = window.URL.createObjectURL(blob) a.dataset.downloadurl = ['text/json', a.download, a.href].join(':') e = new MouseEvent ("click"); //e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null) !!!deprecated!!! a.dispatchEvent(e) } })(console) // 访客详情页关键词收集(打开访客详情页,按F12打开控制台console,直接复制粘贴代码) function collectKeywords(){ var source = document.getElementsByClassName("td-search-keywords align-left"); var temp = []; var result=[]; for (var i = 0; i < source.length; i++) { if(source[i].getElementsByTagName('div')[0]!==undefined){ temp[i] = source[i].getElementsByTagName('div')[0].getAttribute("data-text").match(/