打开浏览器,右键检查网页
在控制台输入以下内容
const noRepeatSpeakSpIds = []
function noRepeatSpeak(text) {
const speech = new SpeechSynthesisUtterance(text);
window.speechSynthesis.speak(speech);
}
function noRepeatGetList() {
const list = document.querySelectorAll('.chat-item')
list.forEach((e) => {
const timestamp = e.getAttribute("data-timestamp")
const l = e.getAttribute("data-uname")
const r = e.getAttribute("data-danmaku")
if (!noRepeatSpeakSpIds.includes(timestamp)&&r) {
console.log(r,timestamp)
noRepeatSpeak(l + '说' + r);
noRepeatSpeakSpIds.push(timestamp)
}
})
}
setInterval(() => {
noRepeatGetList()
}, 1000)
在控制台输入以下内容
const noRepeatSpeakSpIds = []
function noRepeatSpeak(text) {
const speech = new SpeechSynthesisUtterance(text);
window.speechSynthesis.speak(speech);
}
function noRepeatGetList() {
const list = document.querySelectorAll('.chat-item')
list.forEach((e) => {
const timestamp = e.getAttribute("data-timestamp")
const l = e.getAttribute("data-uname")
const r = e.getAttribute("data-danmaku")
if (!noRepeatSpeakSpIds.includes(timestamp)&&r) {
console.log(r,timestamp)
noRepeatSpeak(l + '说' + r);
noRepeatSpeakSpIds.push(timestamp)
}
})
}
setInterval(() => {
noRepeatGetList()
}, 1000)