获取抖音弹幕全网最简单的方法
(chrome扩展开发之注入内容脚本)
console.log("douyinbarrage.js");
const btn=document.createElement('button');
btn.textContent='开始';
btn.style.fontSize="16px";
btn.style.position="fixed";
btn.style.left="0px";
btn.style.bottom="10px";
btn.style.zIndex="999";
btn.style.width="100px";
btn.style.height="50px";
btn.addEventListener('click',()=>{
findtext();
});
document.body.appendChild(btn);
function findtext(){
setInterval(function(){
const b=document.getElementsByClassName('webcast-chatroom___item webcast-chatroom___enter-done');
const c=b[b.length-1];
chrome.storage.local.set({ douyin: c.textContent }).then(() => {
});
},300);
}
chrome.storage.onChanged.addListener((changes, namespace) => {
for (let [key, { oldValue, newValue }] of Object.entries(changes)) {
if(key==='douyin'){
if(oldValue!=newValue){
console.log(newValue);
}
}
}
});


&spm=1001.2101.3001.5002&articleId=143783564&d=1&t=3&u=931b6c7fb0eb4d8f8bc978f0d6df1eb6)
1740

被折叠的 条评论
为什么被折叠?



