您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自动b站点赞投币
当前为
// ==UserScript== // @name b站自动点赞投币 // @namespace http://tampermonkey.net/ // @version 0.80 // @description 自动b站点赞投币 // @author whiteGoose // @match https://www.bilibili.com/video/BV* // @icon http://www.bilibili.com/favicon.ico // @require https://code.jquery.com/jquery-3.7.1.min.js // @license MIT // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_listValues // ==/UserScript== //let curlBV=GetBV(); class Video { constructor(BV, thumbsup, coins, collection) { this.BV = BV; this.thumbsup = thumbsup; this.coins = coins; this.collection = collection; } equals(video) { // console.log(this.BV,video); if (this.BV != video.BV) return false; // if (this.thumbsup != video.thumbsup&&this.coins != video.coins&&this.collection != video.collection) return false; return true; } getVideo() { this.BV = GetBV(); let thumbsup = $("#arc_toolbar_report > div.video-toolbar-left > div.video-toolbar-left-main > div:nth-child(1) > div > span"); thumbsup = thumbsup.text(); let coins = $("#arc_toolbar_report > div.video-toolbar-left > div.video-toolbar-left-main > div:nth-child(2) > div > span"); coins = coins.text(); let collection = $("#arc_toolbar_report > div.video-toolbar-left > div.video-toolbar-left-main > div:nth-child(3) > div > span"); collection = collection.text(); this.thumbsup = thumbsup; this.coins = coins; this.collection = collection; } print() { console.log(this); } } function GetUp() { let name = $(".up-avatar").attr("href"); // console.log(name); if (name != undefined) { name = name.split("/")[3]; return name; } name = $(".membersinfo-upcard"); console.log(name.length); for (var i = 0; i < name.length; i++) { console.log(name[i].children[0].href.split("/")[3]); } return name; } function GetUpName() { let name = $("#mirror-vdcon > div.right-container.is-in-large-ab > div > div.up-panel-container > div.up-info-container > div.up-info--right > div.up-info__detail > div > div.up-detail-top > a.up-name.is_vip"); name = name.text().trim(); if (name == "") { name = $("#mirror-vdcon > div.right-container.is-in-large-ab > div > div.up-panel-container > div.up-info-container > div.up-info--right > div.up-info__detail > div > div.up-detail-top > a.up-name"); name = name.text().trim(); } return name; } function AddId() { let id = GetId(); GetUpName(); if (id == "None") { GM_setValue(GetUp(), [GetUpName(), 0]); //数字0,1,2,3.只点赞,投一个币,投两个币,三连 console.log("已添加"); Init(); } // console.log(id); } function GetId() { let result = GM_getValue(GetUp(), "None"); return result; } function DeleteId() { let deleteResult = GM_deleteValue(GetUp()); console.log("已删除"); Init(); } function GetListId() { console.log(GM_listValues()); } function GetListName() { let list = GM_listValues(); for (var i = 0; i < list.length; i++) { console.log(GM_getValue(list[i])); } } //投币 function toubi() { // console.log("tou?"); let dianzanr = $("#arc_toolbar_report > div.video-toolbar-left > div.video-toolbar-left-main > div:nth-child(1) > div").attr("class") == "video-like video-toolbar-left-item on"; if (dianzanr == true) return false; let toubis = $("#arc_toolbar_report > div.video-toolbar-left > div.video-toolbar-left-main > div:nth-child(2) > div"); toubis.click(); let result = GetId(); setTimeout(function () { if (result[1] == 1) { let quantity = $("body > div.bili-dialog-m > div > div > div.mc.clearfix > div.mc-box.left-con"); quantity.click(); } let confi = $("body > div.bili-dialog-m > div > div > div.coin-bottom > span"); // console.log(confi.text()); confi.click(); }, 1); return true; } //点赞 function dianzan() { let dianzanr = $("#arc_toolbar_report > div.video-toolbar-left > div.video-toolbar-left-main > div:nth-child(1) > div").attr("class") == "video-like video-toolbar-left-item on"; // console.log(dianzanr); if (dianzanr == true) return true; let button = $("#arc_toolbar_report > div.video-toolbar-left > div.video-toolbar-left-main > div:nth-child(1) > div"); if (button == undefined) return false; button.click(); return true; } //初始化按钮 function Init() { let button = $("#gooseAdd"); let button2 = $("#gooseSetting"); button.remove(); button2.remove(); SetButton(); } //设置按钮 function SetButton() { // let upDiv = $("#mirror-vdcon > div.right-container.is-in-large-ab > div > div.up-panel-container > div.up-info-container > div.up-info--right > div.up-info__btn-panel"); //关注行 let upDiv2 = $("#mirror-vdcon > div.right-container.is-in-large-ab > div > div.up-panel-container > div.up-info-container > div.up-info--right > div.up-info__btn-panel > div"); //up名字行 let upDiv3 = $("#mirror-vdcon > div.right-container.is-in-large-ab > div > div.up-panel-container > div.up-info-container > div.up-info--right > div.up-info__detail > div > div.up-detail-top"); // let upDiv1 = $("#mirror-vdcon > div.right-container.is-in-large-ab > div > div.up-panel-container > div.up-info-container > div.up-info--left > div > a > div > div > img"); let button = InitButton(); upDiv3.append(button); if (GetId() != "None") { let settingButton = InitSettingButton(); upDiv3.append(settingButton); } } //获取添加的按钮 function InitButton() { let result = GetId(); let value = ""; if (result == "None") { value = "添加"; } else { value = "删除"; } let button = document.createElement("input"); button.setAttribute("id", "gooseAdd"); button.setAttribute("value", value); button.setAttribute("type", "button"); let styles = "border-radius:6px;border-color:pink;margin-left:10px;height:auto;width:50px;background-color:white;" button.setAttribute('style', styles); if (value == "添加") { button.addEventListener("click", AddId); } else { button.addEventListener("click", DeleteId); } return button; } //获取设置按钮 function InitSettingButton() { let result = GetId()[1]; let value; switch (result) { case 0: value = "只点赞"; break; case 1: value = "投一个币"; break; case 2: value = "投两个币"; break; case 3: value = "三连"; break; } let button = document.createElement("input"); button.setAttribute("id", "gooseSetting"); button.setAttribute("value", value); button.setAttribute("type", "button"); let styles = "border-radius:6px;border-color:pink;margin-left:10px;height:auto;width:50px;background-color:white;" button.setAttribute('style', styles); button.addEventListener("click", setting); return button; } //设置 按钮的详情 function setting() { let result = GetId(); result[1] = (result[1] + 1) % 3; GM_deleteValue(GetId()); GM_setValue(GetUp(), [GetUpName(), result[1]]); Init(); console.log(result); } function GetBV() { let URL = window.location.href.split("/")[4]; return URL; } function IsJunmping(GVideo) { let nowVideo = new Video(); nowVideo.getVideo(); // GVideo.print(); // nowVideo.print(); // console.log(!(GVideo.BV==nowVideo.BV)); return !(GVideo.BV==nowVideo.BV); } let GBV; let Gthumbsup; let Gcoins; let Gcollection; let GVideo = new Video(GBV, Gthumbsup, Gcoins, Gcollection); //页面初始化 function PageInit() { setTimeout(function () { // GVideo.print(); let nowVideo = new Video(); // nowVideo.getVideo(); // nowVideo.print(); let mq = new MessageQueue(1000, 10); mq.Add(function jumping() { return IsJunmping(GVideo); }); mq.Add(function bangdingA() { let temp = $("a"); if (temp == undefined) return false; temp.click(PageInit); //绑定所有的a标签,只要点击则进行判断 return true; }); mq.Add(function bangdingYoubian() { let temp = $(".video-episode-card__info-title"); if (temp == undefined) return false; temp.click(PageInit); //绑定所有的订阅里的视频,只要点击则进行判断 return true; }); mq.Add(function videoEnd() { let temp = $("#bilibili-player > div > div > div.bpx-player-primary-area > div.bpx-player-video-area > div.bpx-player-video-perch > div > video"); if (temp == undefined) return false; temp.on('ended', function videoEndCatch() { setTimeout(function () { $("a").click(PageInit); //绑定视频结束时的视频,只要点击则进行判断 let lianBo=$("#mirror-vdcon > div.right-container.is-in-large-ab > div > div:nth-child(8) > div.base-video-sections-v1 > div.video-sections-head > div.video-sections-head_first-line > div.first-line-right > span > span.switch-button.on"); let lianBo2=$("#reco_list > div.next-play > p > span > span.switch-button.on"); let flag=lianBo.length!=0?true:false; let flag2=lianBo2.length!=0?true:false; if(flag||flag2){ setTimeout(PageInit(),1000); } }, 1); }); return true; }); Init(); //初始化按钮 let result = GetId(); if (result != "None") { //如果被加入了,则投币 switch (result[1]) { case 0: mq.Add(dianzan); break; case 1: mq.Add(toubi); break; case 2: mq.Add(toubi); break; case 3: break; } } mq.Add(function ending(){ nowVideo.getVideo(); GVideo.getVideo(); return true; }); mq.Run(); }, 4000); } class MessageQueue { functionArray = []; timeouts; constructor(timeout, timeouts = 10) { this.timeout = timeout; this.timeouts = timeouts; this.timeouted = 0; } Add(func) { this.functionArray.push(func); } Print() { console.log(this.functionArray); // this.functionArray.forEach(element => { // element(); // }); // console.log("print is ending"); } Run() { console.log("函数列表:", this.functionArray, "超时计数器:", this.timeouted); if (this.functionArray.length == 0) { console.log("所有任务已完成"); return true; } let reslut; let t = this; reslut = this.functionArray[0](); console.log("现在正在运行的函数名为:", this.functionArray[0].name); if (reslut == true || reslut == 1) { t.timeouted = 0; this.functionArray.shift(); } if (this.timeouted == this.timeouts) { console.log("超时!超时的函数为:", this.functionArray[0].name); return false; } timeout = (t.timeouted * 150) + 1; // console.log(t.functionArray); setTimeout(function () { t.timeouted += reslut == true || reslut == 1 ? 0 : 1; t.Run(); }, timeout); } } function faker() { console.log("faker"); } (function () { window.onload = function () { // GetListName(); // GetListId(); PageInit(); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址