您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自动答题
当前为
- // ==UserScript==
- // @name dati
- // @name:zh-CN 大头答题
- // @namespace www.icycat.com
- // @description 自动答题
- // @description:zh-CN 检测答案自动答题
- // @include https://www.douyu.com/9999
- // @include https://www.douyu.com/1209
- // @include https://www.douyu.com/196
- // @version 1.2
- // @run-at document-end
- // ==/UserScript==
- function checkPreview() {
- if (document.querySelector('div[class^="answerPreview"]')) {
- checkAnswer(1);
- console.log('30秒后开始答题,检测答案中..');
- return;
- }
- setTimeout(function() {
- checkPreview();
- }, 1000);
- }
- function checkAnswer(t) {
- var users = ['37丶机器人', '冻猫', 'Desperado柚丶追梦', '钱江湖畔丶姜中陪伴', '枫哥的健身卡', '头顶青天的姜琴', '赵海洋家在临沂', '幽深眼睛', '枫一样的EM', '小姜尸头很大'];
- for (var i = 0; i < users.length; i++) {
- var user = document.querySelectorAll('[data-nn="' + users[i] + '"]');
- if (user.length > 0) {
- var text = user[user.length - 1].parentNode.parentNode.querySelector('.chat-msg-item').innerText;
- switch (text.substr(0, 1).toUpperCase()) {
- case 'A':
- answer(1);
- console.log('检测到神仙答案A');
- return;
- case 'B':
- answer(2);
- console.log('检测到神仙答案B');
- return;
- case 'C':
- answer(3);
- console.log('检测到神仙答案C');
- return;
- }
- }
- }
- if (t > 270) {
- findAnswer();
- return;
- }
- t++;
- setTimeout(function() {
- checkAnswer(t);
- }, 100);
- }
- function findAnswer() {
- var json = {};
- json[1] = 0;
- json[2] = 0;
- json[3] = 0;
- var content = document.querySelectorAll('.chat-msg-item').length ? document.querySelectorAll('.chat-msg-item') : document.querySelectorAll('.Barrage-content');
- for (var i = 0; i < content.length; i++) {
- switch (content[i].innerText.substr(0, 1).toUpperCase()) {
- case 'A':
- json[1]++;
- break;
- case 'B':
- json[2]++;
- break;
- case 'C':
- json[3]++;
- break;
- }
- }
- var tempVal = 0,
- tempKey = '';
- for (var key in json) {
- if (json[key] > tempVal) {
- tempKey = key;
- tempVal = json[key];
- }
- }
- console.log('检测到最多答案为:' + tempKey);
- answer(tempKey);
- }
- function answer(i) {
- var li = document.querySelectorAll('div[class^="answerProblem"] ul li');
- if (li.length > 0) {
- li[i - 1].click();
- console.log('答题完成,19分钟后自动刷新网页');
- setTimeout(function() {
- window.location.reload();
- }, 1140000);
- return;
- }
- setTimeout(function() {
- answer(i);
- }, 20);
- }
- checkPreview();