热浪引擎列表页
// ==UserScript==
// @name 热浪引擎列表页
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author You
// @match https://hot.taobao.com/hw/cooperate/v/task/group
// @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
// @license MIT
// ==/UserScript==
(function() {
'use strict';
var start = new Date().getTime();
var monkey_url = 'http://127.0.0.1:8883/itemList';
elmGetter.selector($);
elmGetter.each('div.tm-item-content div.bdl', company_name => {
console.info('page is fully loaded');
var dataList = [];
// var root_url = window.location.href
// var title = company_name.find('h2 a').attr('title');
var url = 'https://hot.taobao.com' + company_name.find('div a').attr('href');
// var date = company_name.find('p span.date').text();
// if (url!="https://hot.taobao.com/undefined") {
// // 如果不存在,则创建一个 iframe
// var iframe = document.createElement('iframe');
// iframe.id = 'Autopage_iframe';
// iframe.src = url;
// console.info(iframe.src)
//
// document.documentElement.appendChild(document.createElement('style')).textContent = 'iframe#Autopage_iframe {position: absolute !important; top: -9999px !important; left: -9999px !important; width: 100% !important; height: 100% !important; border: none !important; z-index: -999 !important;}';
//
// document.documentElement.appendChild(iframe);
//
// dataList.push({
// // '文章标题': title,
// // '文章日期': date,
// '查看详情链接': url,
// // '目录保存': root_url
// })
//
//
// console.info(dataList);
// var end = new Date().getTime();
// var spend_time = (end - start) / 1000;
// GM_xmlhttpRequest({
// method: "POST",
// url: monkey_url,
// data: JSON.stringify(dataList),
// onload: function (response) {
// //这里写处理函数
// console.log(response);
// console.log(dataList);
// const t3 = Date.now();
// console.log(t3 - start);
// //window.close();
// }
// });
// }
if (url!="https://hot.taobao.comundefined") {
const iframe = document.createElement('iframe');
iframe.src = url;
iframe.style.display = 'none';
document.body.appendChild(iframe);
window.addEventListener('message', e => {
if (e.data.magic === true) {
// document.body.innerHTML = 'Magic!';
elmGetter.selector($);
elmGetter.get([
'div.next-tabs-tabpane div:nth-child(5) div:nth-child(2) div',
'div.next-tabs-tabpane div:nth-child(6) div:nth-child(2) div',
'div.next-tabs-tabpane div:nth-child(7) div:nth-child(2) div',
'div.next-tabs-tabpane div:nth-child(9) div:nth-child(2) div div',
'div.next-tabs-tabpane div:nth-child(11) div:nth-child(2) div',
]).then(([price,payment_time,detail,item,phone_num]) => {
const detailList = {
'任务金额': price.text(),
'最晚交付时间':payment_time.text(),
'需求细节': detail.text(),
'推广宝贝': item.find('a').attr('href'),
'联系方式': phone_num.text()
// '网页内容': document.documentElement.outerHTML
};
console.log(detailList);
var end = new Date().getTime();
var spend_time = (end - start) / 1000;
GM_xmlhttpRequest({
method: "POST",
url: monkey_url,
data: JSON.stringify(detailList),
onload: function (response) {
//这里写处理函数
console.log(response);
console.log(detailList);
const t3 = Date.now();
console.log(t3 - start);
//window.close();
}
});
});
}
});
window.top.postMessage({
magic: true
}, '*');
// 如果不存在,则创建一个 iframe
console.info(iframe.src)
dataList.push({
// '文章标题': title,
// '文章日期': date,
'查看详情链接': url,
// '目录保存': root_url
})
console.info(dataList);
var end = new Date().getTime();
var spend_time = (end - start) / 1000;
GM_xmlhttpRequest({
method: "POST",
url: monkey_url,
data: JSON.stringify(dataList),
onload: function (response) {
//这里写处理函数
console.log(response);
console.log(dataList);
const t3 = Date.now();
console.log(t3 - start);
//window.close();
}
});
}
});
})();