当前位置:网站首页>嗶哩嗶哩 直播分區頁面 自動檢索紅包直播間並跳轉
嗶哩嗶哩 直播分區頁面 自動檢索紅包直播間並跳轉
2022-07-21 00:08: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);
遊猴添加操作簡單演示
啟用即可
控制臺運行
边栏推荐
- 在杭武汉选择网上办理股票开户安全吗?
- ES6 —— Promise VS 函数“回调地狱”
- When byte hung up, the interviewer asked DDD, but I didn't know
- 什麼是複制沖突
- My creation anniversary
- Introduction to kubernetes components
- It's just a TCC distributed transaction. Is it so difficult?
- print-is网页打印
- SAP Spartacus 产品明细页面的 url 设计和数据源
- Office共享协作方法——Office共享的正确打开方式、office365白嫖
猜你喜欢
外表简单内里复杂的功能测试,如何进行?
Siemens low code customer case | overcome communication barriers and solve the bottleneck of application development efficiency
YOLOv5训练自己的voc数据集
Why do you say that the maximum single table of MySQL database is 20million? Based on what?
cdh集群搭建(6.3)
About my writing a Book
完美融入云原生的无代码平台 iVX编辑器实战
Implementation of imx8mp kdump function
关于业务安全平台架构设计,顶象给“我”讲透了
[e-commerce operation] try these five personalized marketing methods to bid farewell to ineffective marketing!
随机推荐
Golang — RESTful框架 go-restful
announce. Net 7 preview 6
Kubernetes - client go component
Which platform is the best and safest to buy stocks on?
Unity3d gameObject
Adding, deleting, querying and modifying MySQL tables (II)
144. Preorder traversal of binary tree
Detailed explanation of mysql5.7 parameters
组件化架构项目搭建——Gradle统一、依赖管理与配置
Circle Game
Helm 介绍
外表简单内里复杂的功能测试,如何进行?
Siemens low code customer case | overcome communication barriers and solve the bottleneck of application development efficiency
关于我写书这件事
IDEA版Postman面世了,功能真心强大
Advantages and disadvantages of several popular cross end technology solutions in 2022
Implementation of imx8mp kdump function
Leetcode回文链表
根据子节点递归获取所有父节点集合
读书笔记之数据密集型应用的可维护性