本帖最后由 夜泉 于 2023-4-16 01:05 编辑
某个加密的文心一言去水印脚本。。。
用了挺久了...
// ==UserScript==
// @name 文心一言去除水印(文心一言助手)
// @namespace http://tampermonkey.net/
// @version 0.9
// @description 去除文心一言页面的水印,去除AI作图的水印、头像改为默认头像。
// @author 我是小学生
// @match https://yiyan.baidu.com/*
// @icon https://nlp-eb.cdn.bcebos.com/logo/favicon.ico
// @grant none
// @license GPL-3.0
// @run-at document-end
// @supportUrl https://github.com/1595901624/ERNIEBotHelper
// ==/UserScript==
(function () {
'use strict';
const aiImageWaterFlag = "x-bce-process=style/wm_ai";
const pattern = /[\w]{8}/;
var _createTextNode = document.createTextNode.bind(document);
document.createTextNode = function (e) {
if (pattern.test(e)) {
return _createTextNode("");
}
return _createTextNode(e);
};
setInterval(hideAIImageWatermark, 1000);
function hideAIImageWatermark() {
let imgN = document.querySelectorAll("img");
if (imgN == null) {
return;
}
imgN.forEach(img => {
let isrc = img.getAttribute("src");
if (isrc != null && isrc.indexOf(aiImageWaterFlag) != -1) {
if (isrc.indexOf(aiImageWaterFlag) != -1) {
console.log("隐藏图片水印!");
img.setAttribute("src", isrc.replace(aiImageWaterFlag, ""));
}
}
if (isrc != null && img.getAttribute("alt") == "头像" && isrc.indexOf("icon-rb") == "-1") {
console.log("设置头像为默认值!");
img.setAttribute("src", "https://nlp-eb.cdn.bcebos.com/logo/favicon.ico");
}
});
}
})();
|