您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
获取直播弹幕信息并发送详情
当前为
// ==UserScript== // @name 弹幕助手 // @namespace http://tampermonkey.net/ // @version 1.0.3 // @description 获取直播弹幕信息并发送详情 // @match https://liveplatform.taobao.com/* // @icon https://cdn.52ym.vip/temp/a0whr-l6z8y-001.ico // @grant none // @license MIT // ==/UserScript== const TIME = 3000; const platformMap = new Map([ ['taobao', handleTaoBaoBarrage] ]); let barrageIds = []; // 存储已处理的弹幕ID function handleRequest(username, content, id) { // 构造弹幕数据对象 let data = { nickname: username, content: content }; console.log(data); // 将已处理的弹幕ID添加到列表中 barrageIds.push(id); if (barrageIds.length > 300) { barrageIds.splice(0, 100); } } function handleTaoBaoBarrage() { let barrageContainer = document.querySelector('#rc-tabs-1-panel-AssistantCommentCard > div.alpw-container > div > div:last-child'); if (!barrageContainer) { return; // Exit if the barrage container element is not found } let barrageElements = barrageContainer.querySelectorAll('div.alpw-comment-item'); for (let i = 0; i < barrageElements.length; i++) { let barrageElement = barrageElements[i]; let usernameElement = barrageElement.querySelector('div.alpw-userinfo > div > div > div.alpw-username-text'); let contentElement = barrageElement.querySelector('div.alpw-comment-content'); // 检查弹幕元素是否存在 if (!usernameElement || !contentElement) { continue; // Skip if either username or content element is not found } let username = usernameElement.textContent.trim(); let content = contentElement.textContent.trim(); console.log("current username:",username); console.log("current content:",content); let id = username + content; // 检查是否已处理过该弹幕 if (barrageIds.includes(id)) { continue; } handleRequest(username, content, id); } } (function () { setTimeout(()=>{ const currUrl = window.location.href; console.log("开启直播了..................",currUrl) ; platformMap.forEach((value, key) => { if (currUrl.indexOf(key) !== -1) { setInterval(value, TIME); } }); },10000) })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址