tiansh/us-danmaku

无显示按钮

Opened this issue · 3 comments

脚本名称:
bilibili ASS Danmaku downloader
遇到的问题:
页面没有显示按钮

我遇到了相同的问题,不知道怎么回事,可能是因为B站改版,页面元素发生变化导致的。

帮忙调试了一下,发现原因是,因为 B 站的视频播放部分改版了,获取不到弹幕的 cid 标识,需要改动的代码如下。

函数 getCid 内容更换为
var cid = null; try { cid = document.getElementById('cid').innerHTML; } catch (e) { } if (cid) callback(Number(cid)); else { setTimeout(getCid, 100, callback); }

函数 init 开头添加这一段代码
GM_xmlhttpRequest({ 'method': 'GET', 'url': window.location.href, 'onload': function (resp) { // var temp = resp.toString(); var temp = JSON.stringify(resp); var text = temp.substr(temp.indexOf('EmbedPlayer'), 100); text = text.substring(text.indexOf('cid=') + 4); text = text.match(/^\d+/)[0]; var div = document.createElement('div'); div.innerHTML = '<div id="cid" style="display: none">' + text + '</div>'; document.getElementById('float_window').appendChild(div); } });

doio commented

谢谢楼上已经添加成功并且可以用啦!