UID:659797531432 帖
2024-10-15 04:33
回复 Nikalaser2024-10-15 00:35
之前大佬编写的脚本我这边没有失效,应该是你的问题他的脚本方法读了一下应该是改变浏览器的属性来通过原网页的检测,好像还要搭配修改ua的插件实现,你的问题有可能是修改ua的插件出了问题导致检测不通过
看了一下原网页,代码写的是检测不通过的时候会给你跳转到错误网页,换个思路直接修改网页的脚本代码跳过检测失败的跳转部分或许可以不去考虑ua插件失效的问题,网上抄了个脚本自己修改了一下,本机火狐、edge测试通过
点击展开
// ==UserScript==// @name replaceJS-dmm// @namespace http://tampermonkey.net/// @version 0.1// @AuThor alexPencil// @match *://www.trepy.jp/*// @match *://point-news.jp/*// @match *://www.life-n.jp/*// @match *://www.news-fan.jp/*// @grant none// @run-at document-start// ==/UserScript==(function() { 'use strict'; const dispatch = (script, target) => { if(script.tagName !== "SCRIPT") { return; } window.onbeforescriptexecute(script); } const observer = new MutationObserver(mutations => { for(const m of mutations) { m.addedNodes.forEach(n => { dispatch(n, m.target); }) } }) observer.observe(document, { childList: true, subtree: true, }); window.onbeforescriptexecute = (e) => { if(!e.textContent) {return;} //将要替换的js语句填入relaaceTxt函数 replaceTxt(e, ` location.href = '/sp/error-disp/?chk=3';`, "console.log('alexPencil1')"); } function replaceTxt(script, target, change) { let textContent = script.textContent; if (textContent.includes(target)) { script.textContent = textContent.replace(target,change); } }})(); javascript参考文献 https://www.52pojie.cn/thread-1687961-1-1.html