tiansh / us-danmaku

Firefox 扩展版本见 https://github.com/tiansh/ass-danmaku ;在线转换见 https://tiansh.github.io/ass-danmaku-online/ ;【用户脚本已停止维护】用户脚本 以ass格式下载 AcFun 和 bilibili 的弹幕
210 stars 48 forks source link

无显示按钮 #25

Open RoadToDream opened 7 years ago

RoadToDream commented 7 years ago

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

Kannnnng commented 7 years ago

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

Kannnnng commented 7 years ago

帮忙调试了一下,发现原因是,因为 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 7 years ago

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