本帖最后由 myf 于 2024-1-3 18:26 编辑
(function () {
'use strict';
// Your code here...
let count = 0;
const maxAttempts = 100;
const intervalId = setInterval(() => {
const element = document.querySelector("#bilibili-player > div > div > div.bpx-player-primary-area > div.bpx-player-video-area > div.bpx-player-control-wrap > div.bpx-player-control-entity > div.bpx-player-control-bottom > div.bpx-player-control-bottom-right > div.bpx-player-ctrl-btn.bpx-player-ctrl-playbackrate > ul > li:nth-child(2)");
const element2 = document.querySelector("#bilibili-player > div > div > div.bpx-player-primary-area > div.bpx-player-video-area > div.bpx-player-control-wrap > div.bpx-player-control-entity > div.bpx-player-control-bottom > div.bpx-player-control-bottom-right > div.bpx-player-ctrl-btn.bpx-player-ctrl-full");
if (element && element2) {
clearInterval(intervalId);
element.click();
element2.click();
}
count++;
if (count >= maxAttempts) {
clearInterval(intervalId);
console.log("没有找到元素");
}
}, 100);
})();
想实现的功能就两个,一个是自动1.5倍播放,这个已经实现,但是自动全屏实现不了(在控制台中是可以实现的),有大佬能帮忙指点一下吗?