Skip to content

Instantly share code, notes, and snippets.

@teeceepee
Last active January 3, 2016 20:59
Show Gist options
  • Save teeceepee/8518727 to your computer and use it in GitHub Desktop.
Save teeceepee/8518727 to your computer and use it in GitHub Desktop.
bilibili优酷黑科技
// 只访问播放器页面
javascript:location.href='https://secure.bilibili.tv/secure,cid='+document.getElementById('bofqi').childNodes[2].attributes.flashvars.value.split(/[=&]/)[1];
// 替换优酷播放器,保留页面其他内容。将所有内容用void()包裹来防止页面刷新, 参考 http://www.ruanyifeng.com/blog/2011/06/a_guide_for_writing_bookmarklet.html
javascript:void(document.getElementById('bofqi').innerHTML='<iframe width="950" scrolling="no" height="482" frameborder="no" onload="window.securePlayerFrameLoaded=true" framespacing="0" border="0" src="####" class="player"></iframe>'.replace("####",'https://secure.bilibili.tv/secure,cid='+document.getElementById('bofqi').childNodes[2].attributes.flashvars.value.split(/[=&]/)[1]));
var cid = document.getElementById('bofqi').childNodes[2].attributes.flashvars.value.split(/[=&]/)[1];
var url = 'https://secure.bilibili.tv/secure,cid=' + cid;
var template = '<iframe width="950" scrolling="no" height="482" frameborder="no" onload="window.securePlayerFrameLoaded=true" framespacing="0" border="0" src="####" class="player"></iframe>';
var html = template.replace("####", url);
document.getElementById('bofqi').innerHTML = html;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment