Last active
September 15, 2017 21:58
-
-
Save smy20011/cca6a557687c54f3fde1aa14962b910e to your computer and use it in GitHub Desktop.
Unblock bilibili without proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Unblock bilibili without proxy. | |
// @match https://www.bilibili.com/video/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
if (options.type == "articleError") { | |
const aid = document.URL.match(/av(\d+)/)[1]; | |
var xhr = new XMLHttpRequest(); | |
xhr.open("GET", "https://www.bilibili.com/widget/getPageList?aid=" + aid, false); | |
xhr.send(); | |
const cid = JSON.parse(xhr.responseText)[0].cid; | |
window.location.replace(`http://www.bilibili.com/html/html5player.html?aid=${aid}&cid=${cid}`); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment