作者:_路過蓅颩_ | 来源:互联网 | 2023-09-01 21:06
代码:
// ==UserScript==
// @name 自动评论哔哩哔哩视频
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.bilibili.com/*
// @grant none
// ==/UserScript==
(function(){// 等待两秒钟再进行评论setTimeout(function(){var c=["陌生人好好的呦。","别看啦,照顾好自己","喧闹的世界,看到这条评论。洗洗睡吧吧!"];var n = -1;var m = 3;var temp_count = Math.floor(Math.random()*(n-m+1))+m;//取m-n之间的随机数 [m,n]//document.getElementsByClassName("tool-item-comment")[0].click();//能够打开评论区啦var time = new Date();var t = " 我在: " +time.getFullYear()+"年 "+(time.getMonth()+1)+"月 "+time.getDate()+"日 "+time.getHours()+":"+time.getMinutes()+":"+time.getSeconds()+" 来过!";//document.getElementById("comment_content").value = t//评论时间document.getElementsByClassName("ipt-txt")[0].value = c[temp_count] + t;//能够赋值啦document.getElementsByClassName("comment-submit")[0].click(); //发表评论成功!},9999);//ajax do something
})();
结果: