您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
滚动到底部若干次,然后模拟点击展开所有评论,供singlefile保存用
// ==UserScript== // @name 知乎评论展开 // @namespace http://tampermonkey.net/ // @version 2024-05-032 // @description 滚动到底部若干次,然后模拟点击展开所有评论,供singlefile保存用 // @author You // @match https://www.zhihu.com/question/* // @icon https://www.google.com/s2/favicons?sz=64&domain=zhihu.com // @grant none // @license GPL-3.0 License // ==/UserScript== // setInterval(() => { // // window.scrollTo(0, document.documentElement.scrollHeight - window.innerHeight); // window.scrollTo(0, document.documentElement.scrollHeight); // window.scrollBy(0,-100); // }, 5000); const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay)) let count = 0; // 计数器,用于记录执行次数 const intervalId = setInterval(() => { window.scrollTo(0, document.documentElement.scrollHeight); window.scrollBy(0,-100); count++; // 每次执行计数器加 1 // 如果执行次数达到 10 次,则停止定时器 if (count === 10) { clearInterval(intervalId); // 清除定时器 } }, 1000); setTimeout(async () => { let nodelist = document.querySelectorAll("div.ContentItem-actions > button:nth-child(2)"); nodelist.forEach(element => { element.click() }); await sleep(3000) document.querySelector("div.css-1aq8hf9 > button").click() }, 11000);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址