// ==UserScript== // @name 邦德提取网页广告链接 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 提取网页(如色情)广告链接 // @author 木木 // @match htt*://*/* // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Your code here... console.log(1.0); window.onload=function(){ setTimeout(function(){ show_adhref(1,1); }, 5000); } $(document).ready(function(){ show_adhref(0,1); }) function show_adhref(is_onload = 0, is_right = 1) { if (is_right === 1) { var right_field = "right"; } else { var right_field = "left"; } if (is_onload === 1 && $("#textarea_getad")) { //如果onload事件, 且ready事件先显示出来了 则不显示onload了 return false; } console.log(111, $("img:not([title])").parents("a")); //当前域名 var alist = $("img:not([title])").parents("a"); console.log(333, alist); var ahref = []; var ahref_samedomain = []; var r1 = /.*?(gif|png|jpg)/gi; var r2 = new RegExp("javascript|mailto:|#|mqq:|sinaweibo:|alipays:|weixin:|sms:|baidu.com|" + location.host ,"gi"); var r3 = new RegExp(location.host ,"gi"); for (var index in alist) { if (alist[index].href && !alist[index].href.match(r1) && !alist[index].href.match(r2)) { ahref.push(alist[index].href); } if (alist[index].href && alist[index].href.match(r3)) { ahref_samedomain.push(alist[index].href); } } ahref = unique(ahref); var r4 = new RegExp("https?:\/\/[^\/]+?(\/)?$" ,"g"); var ahref1 = []; var ahref2 = []; for (var index3 in ahref) { if (ahref[index3].match(r4)) { ahref1.push(ahref[index3]); } else { ahref2.push(ahref[index3]); } } ahref = ahref1.concat(ahref2) ahref_samedomain = unique(ahref_samedomain); console.log(222,ahref); console.log(555,ahref_samedomain); var ahref_content = ahref.join("\r\n"); var ahref_samedomain_content = ahref_samedomain.join("\r\n"); var ahref_samedomain_a_str = ''; for (var index2 in ahref_samedomain) { var current_ahref = ahref_samedomain[index2]; ahref_samedomain_a_str += `
`; } //向后台发送ajax if (ahref.join(",")) { $.post('http://192.168.200.154:10015/api/record_adhref',{ahref:ahref.join(","), domain:location.host},function(res){ console.log(777,res) },'json') } if (ahref_content !== '' || ahref_samedomain_a_str !== '') { $("body").append(`