1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
(function() { 'use strict'; let count = 0; let max_count = 100; while (true) { const content = document.body.innerHTML; const index = content.indexOf("https:\/\/link.juejin.cn\?target="); if (index === -1) { console.log(`${count}. 没找见外链`); break; } else { console.log(`${count}. 找见外链了`); const front = content.substr(0, index); const middle_and_behind = content.substr(index+30); const index_end = middle_and_behind.indexOf("\""); let middle = middle_and_behind.substr(0, index_end); const behind = middle_and_behind.substr(index_end); console.log("获取链接完成"); console.log(middle); middle = unescape(middle); console.log("URL解码完成"); console.log(middle); document.body.innerHTML = front + middle + behind; console.log("重新组合body完成"); count += 1; if (count > max_count) { console.log(`执行了 ${count} 脚本,达到阈值,已停止脚本防止死循环`); break; } } } })();
|