【新】欢庆网自动搜索请柬console方法,面对多种网站改版的情况
生活随笔
收集整理的這篇文章主要介紹了
【新】欢庆网自动搜索请柬console方法,面对多种网站改版的情况
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
//自動搜索指定的請柬
var alertTipText = "請柬找到了,就在這個網頁里面,自己仔細看吧";
var delay = 1 * 1000;//1秒后循環下一頁尋找
/*獲取子DOM元素在父元素里面的索引位置(是第幾個元素)*/
function getNodeListIndex(childNode) {return childNode && childNode.parentNode ? Array.prototype.indexOf.call(childNode.parentNode.children, childNode) : null;
}var curUrl = location.href;function autoFind() {var dom = document.querySelector("frame").contentDocument;if (dom.body.innerHTML.includes(id)) {console.log("%c" + alertTipText, "background:red;color:white;font-size:30px;");alert(alertTipText);return " ↑ 請 柬 找 到 了 ↑ ";} else {var nextPageBtn = dom.querySelector("a.a1:last-child");curUrl = nextPageBtn.href;nextPageBtn.click();setTimeout("autoFind()", delay);}
}var reload = function () {
//【核心代碼】小到可以循環操作一些簡單繁瑣工作,大到可以進行數據挖局圖片抓取!with (document) {write("<frameset cols='*'><frame src='" + location + "'/></frameset>"), void (close());}setTimeout("autoFind()", delay);
};
reload();var id = "H532ki1cutQV";//這個字符串來自于客戶發的請柬鏈接最后一個斜杠后面那串
?
總結
以上是生活随笔為你收集整理的【新】欢庆网自动搜索请柬console方法,面对多种网站改版的情况的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 命令行创建React项目
- 下一篇: 设置IDEA编辑过程直接通过F5刷新网页