当前位置:网站首页>哔哩哔哩 直播分区页面 自动检索红包直播间并跳转
哔哩哔哩 直播分区页面 自动检索红包直播间并跳转
2022-07-19 23:49:00 【Love丶伊卡洛斯】
使用说明
添加脚本至游猴插件,如果没有游猴也可以直接控制台贴入运行
自动检索直播分区页面 https://live.bilibili.com/p/eden/area-tags?parentAreaId=9&areaId=0
,
然后按下 F1 或 F2 开始滚动获取红包页面,最长滚动时间1分钟。
话不多说 直接上效果
源码如下(内容复制到游猴新建脚本保存即可,当然也可以直接控制台运行):
// ==UserScript==
// @name b站直播分区页面 自动检索红包直播间并跳转 脚本
// @namespace http://tampermonkey.net/
// @version 1.2
// @description 配合 b站直播自动抽红包脚本使用。来到对应直播分区页面,如:https://live.bilibili.com/p/eden/area-tags?parentAreaId=9&areaId=0 按“F1”或“F2”开始运行
// @author Ikaros
// @match https://live.bilibili.com/p/eden/area-tags*
// @grant unsafeWindow
// @grant GM_openInTab
// @license MIT
// ==/UserScript==
/* 使用说明: 配合 b站直播自动抽红包脚本使用。 来到对应直播分区页面,如:https://live.bilibili.com/p/eden/area-tags?parentAreaId=9&areaId=0 按“F1”或“F2”开始运行 */
// 循环变量
var my_loop;
// 下滑延时 500毫秒 网速/加载速度较慢的朋友们最好放慢速度 提高准确性
var r_time = 500;
// 下滑
function r()
{
window.scroll(0, 1080*1000);
// 没有新数据后自动停止下滑 并 页面跳转
if(document.getElementsByClassName("no__data").length == 1)
{
console.log("停止下滑循环");
// 停止下滑循环
stop_r();
}
}
// 停止下滑循环
function stop_r()
{
console.log("停止下滑循环");
clearInterval(my_loop);
// 页面跳转
jump_to_page();
}
// 页面跳转
function jump_to_page()
{
console.log("开始页面跳转");
var page_num = document.getElementsByClassName("Item_3bUJ8ZZT").length;
console.log("红包直播间数:" + page_num);
for(var i = 0; i < page_num; i++)
{
if(document.getElementsByClassName("Item_3bUJ8ZZT")[i].innerText == '红包')
{
console.log("跳转i:" + i);
// document.getElementsByClassName("Item_3bUJ8ZZT")[i].click();
// active:true,新标签页获取页面焦点
// setParent :true:新标签页面关闭后,焦点重新回到源页面
GM_openInTab(document.getElementsByClassName("index_3Uym8ODI")[i].getElementsByTagName("a")[0].href, {
active: false, setParent :true});
}
}
}
// 传递传递参数event
function keydown(event)
{
// “112”为按键F1,可根据需要修改为其他
if (event.keyCode == 112 || event.keyCode == 113) {
// 按下后执行的代码
go();
}
}
function go()
{
console.log("开始运行");
// 最长下滑1分钟时间
setTimeout(stop_r, 60000);
// 开始自动下滑 r_time毫秒一次
setTimeout(function(){
my_loop = setInterval(r, r_time);}, 100);
}
document.addEventListener("keydown", keydown);
游猴添加操作简单演示
启用即可
控制台运行
边栏推荐
猜你喜欢
Cnpm installation
144. Preorder traversal of binary tree
1235. 规划兼职工作 动态规划
ES6 —— Promise VS 函數“回調地獄”
Software performance test plan - performance test preparation
FAQ - build a business security platform architecture. Here are all the answers you want!
Helm introduction
App 应用测试方法以及测试思路……
洛谷P1955 程序自动分析
Successfully solved -- MySQL container command line is displayed in Chinese as??? Problems of
随机推荐
C language basic drill (6)
中国大陆IP段(含港澳)【2022-07-15】
「架构师合集」
ES6 —— Promise VS 函數“回調地獄”
为什么大家说mysql数据库单表最大两千万?依据是啥?
【电商运营】试试这5种个性化营销方法,告别无效营销!
Print is web page printing
.NET 使用自带 DI 批量注入服务(Service)和 后台服务(BackgroundService)
股票开户网上办理的话安全吗。股票开户去哪里。
洛谷P1918 保龄球
Reading record "brain maintenance is urgent"
数据仓库中的元数据管理!
C语言基础演练(6)
ES6 - promise vs function "callback hell"
Successfully solved -- MySQL container command line is displayed in Chinese as??? Problems of
App 应用测试方法以及测试思路……
什么是复制冲突
nextTick那些事儿
根据二叉树的中序和后续遍历
As for the architecture design of business security platform, the top image has been explained to "me"