Skip to content

Instantly share code, notes, and snippets.

@smy20011
Last active September 15, 2017 21:58
Show Gist options
  • Save smy20011/cca6a557687c54f3fde1aa14962b910e to your computer and use it in GitHub Desktop.
Save smy20011/cca6a557687c54f3fde1aa14962b910e to your computer and use it in GitHub Desktop.
Unblock bilibili without proxy
// ==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