您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自动b站点赞投币
当前为
// ==UserScript== // @name b站自动点赞投币 // @namespace http://tampermonkey.net/ // @version 0.9 // @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 // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js // @license MIT // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_listValues // ==/UserScript== 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(); let data=[]; for (var i = 0; i < list.length; i++) { // console.log(GM_getValue(list[i]),list[i]); let status=GM_getValue(list[i]); let result={'uid':list[i],'name':status[0],'mode':status[1]} data.push(result) } console.log(data) return data; } //投币 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"); let button3= $("#gooseInfo"); button.remove(); button2.remove(); button3.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 div4=$("#mirror-vdcon > div.right-container.is-in-large-ab > div > div.up-panel-container"); let customerDiv=$("<div id='gooseCustomerDiv'></div>"); customerDiv.css({ "text-align": "center", }) let button = InitButton(); let infoButton=InitInfoButton(); div4.append(customerDiv); customerDiv.append(infoButton); if (GetId() != "None") { let settingButton = InitSettingButton(); customerDiv.append(settingButton); } customerDiv.append(button); } //获取添加的按钮 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:25%;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=whatModeIs(result); 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:25%;background-color:white;" button.setAttribute('style', styles); button.addEventListener("click", setting); return button; } //获取信息按钮 function InitInfoButton(){ let button=document.createElement("input"); button.setAttribute("id", "gooseInfo"); button.setAttribute("value","列表"); button.setAttribute("type", "button"); let styles = "border-radius:6px;border-color:pink;margin-left:10px;height:auto;width:25%;background-color:white;" button.setAttribute('style', styles); button.addEventListener("click",Info); return button; } //信息详情 function Info() { let text = "<table id='gooseTable'>" + "<thead>" + "<tr>" + "<td>uid</td>" + "<td>up名</td>" + "<td>设置</td>" + "<td>操作</td>" + "</tr>" + "</thead>" + "<tbody id='gooseUpsBody'>" + "</tbody>" + "</table>"; Swal.fire({ title: '自动点赞的列表', html: text, showConfirmButton: false, showCloseButton: true, }) let data=GetListName(); data.forEach((element) => { let uid = element['uid']; let name = element['name']; let mode =whatModeIs(element['mode']); let tr = ` <tr> <td class="canclick" id="gooseUid">${uid}</td> <td class="canclick">${name}</td> <td class="canclick" id="gooseMode">${mode}</td> <td>删除</td> </tr> `; $("#gooseUpsBody").append(tr); $("#gooseTable").css({ "width": "100%", "border-collapse": "collapse", }) $("#gooseTable tr td").css({ "border": " 1px solid #ccc", "cursor":"pointer", }) }) $("#gooseTable tbody tr").each((index,element)=>{ let uid=$(element).children()[0]; let name=$(element).children()[1]; let mode=$(element).children()[2]; let del=$(element).children()[3]; let thisId=$(uid).text() let thisName=$(name).text(); if(thisId==GetUp()){ $(element).css({"background-color":"#bae5ff"}) } $(uid).click(()=>{ // console.log($(uid).text(),$(uid).val()) window.open("https://space.bilibili.com/"+$(uid).text(),"_blank") }) $(name).click(()=>{ window.open("https://space.bilibili.com/"+$(uid).text(),"_blank") }) $(mode).click(()=>{ let result = GM_getValue(thisId); result[1] = (result[1] + 1) % 3; GM_deleteValue(thisId); GM_setValue(thisId, [thisName, result[1]]); $(mode).text(whatModeIs(result[1])) // console.log(result); if(thisId==GetUp()) Init(); }) $(del).click(()=>{ console.log($(element)); GM_deleteValue($(uid).text()); $(element).remove() if(thisId==GetUp()) Init(); }) }) } function whatModeIs(id){ let mode=""; switch (id) { case 0: mode = "只点赞"; break; case 1: mode = "投一个币"; break; case 2: mode = "投两个币"; break; case 3: mode = "三连"; break; } return mode; } //设置 按钮的事件 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(BV,send) { console.log(BV,send); console.log(BV!=GetBV()); if(BV==GetBV()&&send!=0){ console.log("还没跳转哦") setTimeout(IsJunmping,3000,BV,send-=1) } if(BV!=GetBV()){ console.log("跳转啦!") setTimeout(PageInit(),1); return true; } if(send==0){ console.log("你是不是取消了呀?") return false; } console.log("what happend?"); } //页面初始化 function PageInit() { setTimeout(function () { let mq = new MessageQueue(1000, 10); 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; let BV=GetBV(); if(flag||flag2){ let result=IsJunmping(BV,5); // setTimeout(PageInit(),1); } }, 1); }); return true; }); Init(); //初始化按钮 let result = GetId(); if (result != "None") { //如果被加入了,则投币 switch (result[1]) { case 0: mq.Add(dianzan); break; case 1: case 2: mq.Add(toubi); break; case 3: break; } } 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 () { // console.log(GetUp()); PageInit(); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址