// ==UserScript== // @name 🥇【好医生小助手】全网唯一真实免费|无人值守|自动静音|自动联播 // @namespace https://cmechina.net/ // @version 1.7 // @description 自动播放视频 // @author 韦同学 // @match *.cmechina.net/cme/study2.jsp?course_id=202401007786&courseware_id=* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; const handleVideo = () => { const videoElement = document.querySelector("video"); if (videoElement) { videoElement.muted = true; videoElement.playbackRate = 1; // 设置默认倍速为1倍 videoElement.play().catch(error => { console.error('视频播放失败:', error); }); videoElement.addEventListener('ended', playNextVideo); } else { console.log('没有找到视频元素'); setTimeout(handleVideo, 2000); // 重试 } }; const playNextVideo = () => { const lis = document.querySelectorAll("ul.s_r_ml > li"); const activeElement = document.querySelector("li.active"); if (!activeElement) { console.log('没有找到当前播放的视频元素'); return; } let index = Array.from(lis).findIndex(li => li === activeElement); if (index + 1 < lis.length) { index += 1; setTimeout(() => { lis[index].querySelector("a").click(); }, 5000); // 延迟5秒再点击下一个视频 } else { console.log('已经是最后一个课程'); } }; window.addEventListener('load', () => { setTimeout(handleVideo, 3000); // 等待3秒确保页面加载完成 }); })();