Skip to content

Instantly share code, notes, and snippets.

@kasuganosora
Last active December 20, 2015 06:49
Show Gist options
  • Save kasuganosora/6088478 to your computer and use it in GitHub Desktop.
Save kasuganosora/6088478 to your computer and use it in GitHub Desktop.
BILIBILI禁止是用爱奇艺和youku的播放器UserScript
// ==UserScript==
// @name Bilibili Player
// @namespace http://blog.hcg.im/
// @version 0.2
// @description Bilibili Player
// @match http://www.bilibili.tv/video/av*
// @copyright 2013+,ReitsukiSion
// 请把这个规则加到 *://interface.bilibili.tv/playurl* SwitchySharp 的翻墙列表里
// ==/UserScript==
$(function(){
var replaceBFQ = false;
var aid = window.aid;
var bfq = $("#bofqi");
var cid;
var cidReg;
var cidMatch;
if(bfq.find("script").length != 0){
//爱奇艺
var cidReg = /cid:'(.+?)'/;
cidMatch = cidReg.exec(bfq.html());
cid = cidMatch[1];
replaceBFQ = true;
}
var youku = $("embed[src*='youku.swf']");
if(youku.length){
replaceBFQ = true;
var flashvars = youku.attr('flashvars');
cidReg = /bili\-cid=(.+?)&/;
cidMatch = cidReg.exec(flashvars);
cid = cidMatch[1];
}
if(replaceBFQ){
bfq.html('<embed height="482" allowfullscreeninteractive="true" width="950" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" allowscriptaccess="always" rel="noreferrer" flashvars="cid='+cid+'&amp;aid='+aid+'" src="http://static.hdslb.com/play.swf" type="application/x-shockwave-flash" allowfullscreen="true" quality="high" style="width: 950px; height: 484px;">');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment