淘宝商家列表页
// ==UserScript==
// @name 淘宝商家列表页
// @namespace http://tampermonkey.net/
// @version 2024-01-14
// @description try to take over the world!
// @author You
// @match https://shopsearch.taobao.com/search?q=*
// @icon https://www.google.com/s2/favicons?sz=64&domain=taobao.com
// @require http://cdn.bootcss.com/jquery/1.11.2/jquery.js
// @require https://scriptcat.org/lib/513/2.0.0/ElementGetter.js
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
var monkey_url = 'http://127.0.0.1:8883/itemList';
// // ————————调试部分————————
//
// elmGetter.selector('css');
// elmGetter.each('*', wenzi, el => {
// console.log(el.cloneNode(true));
// // console.log(el.getElementsByTagName("a")[0].text())
// });
// // ————————调试部分结束————————
elmGetter.selector($);
elmGetter.each('ul#list-container li', company_name => {
console.log(company_name);
console.log('page is fully loaded');
var dataList = [];
var shop_url = company_name.find('a.shop-name.J_shop_name').attr('href')
if (shop_url) {
shop_url = 'https:' + shop_url
dataList.push({
'店铺地址': shop_url
})
}
if (dataList.length > 0){
console.log(dataList);
GM_xmlhttpRequest({
method: "POST",
url: monkey_url,
data : JSON.stringify(dataList),
onload: function(response) {
//这里写处理函数
console.log(response);
console.log(dataList);
//window.close();
}
});
}
});
// Your code here...
})();