I don’t know how weibo.com works inside. But that's about it. But it’s better to look for ready-made spam scripts and modify them.
// ==UserScript==
// @name New script weibo.com
// @namespace Violentmonkey Scripts
// @match https://weibo.com/*
// @grant none
// @version 1.0
// @author -
// @description 3/9/2024, 2:27:50 PM
// ==/UserScript==
const text = '拍马屁';
const maxCount = 5;
let leftCount = 0;
// on expand comment
document.body.addEventListener('click', ()=> {
leftCount = maxCount;
fn();
}, true);
// loop
function fn() {
if (leftCount) {
--leftCount;
fn2();
}
}
function fillForm() {
waitElement('.woo-box-item-flex [compser="true"] textarea')
.then(async textarea => {
while (!textarea.value) {
await new Promise(r => setTimeout(r, 500));
textarea.value = text;
document.querySelector('.woo-box-flex.woo-box-alignCenter > button.woo-button-main.woo-button-primary')?.click();
fn();
}
});
}
function waitElement(selector, container) {
if (container && !(container instanceof HTMLElement)) return console.error('wait > container not HTMLElement:', container);
return new Promise(resolve => {
if (element = (container || document.body || document).querySelector(selector)) return resolve(element);
const observer = new MutationObserver(mutations => {
if (element = (container || document.body || document).querySelector(selector)) {
resolve(element);
observer.disconnect();
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
thank you so much.I will try it,but i need some time to got it tha how to ues or revise this code,please give me some time and thank you again.
If you have questions about the code, you can ask, I will try to answer
but this is a solution that I was quickly able to implement and is not optimal.
I recommend looking for ready-made solutions. The most advanced on Selenium. There are many video lessons and ready scripts.
Good Luck!
本人0经验,对脚本的理解全在某站搜索中一点点摸索,非常想要一个可以(在某一特定微博推文下进行大量回复的自动回复脚本)回复内容可以不变。
基本回复流程为(在人工打开某博文全部评论页面后--开启脚本--点击评论--输入文字(已在剪贴板复制好)--点击回复--等待微博出现并消失【回复评论成功】的字眼)然后从点击下一个未回复的评论开始循环
有偿。经济能力有限,但一定满足道上规矩,希望能收到您的回信,谢谢。