大家好,欢迎来到IT知识分享网。
// ==UserScript==
// @name B-HTML5-Video
// @version 0.1.5
// @description 获取视频的flv地址
// @author zwb
// @match https://www.bilibili.com/video/BV*
// @match https://www.bilibili.com/video/av*
// @run-at document-idle
// @connect bilibili.com
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @namespace https://greasyfork.org/zh-CN/users/
// ==/UserScript==
setTimeout(function(){
var infobar=document.querySelector(“#v_desc”);
var jsontag =document.createElement(“a”);
var that=unsafeWindow;
var vdata=that.__INITIAL_STATE__.videoData;
var jsonlink=”https://api.bilibili.com/x/player/playurl?otype=json&qn=120&fourk=1&cid=”+vdata.cid+”&avid=”+vdata.aid;
if (vdata.videos>1 && vdata.pages.length>1){
var b_p=that.__INITIAL_STATE__.p-1<0?0:that.__INITIAL_STATE__.p-1;
jsonlink=”https://api.bilibili.com/x/player/playurl?otype=json&qn=120&fourk=1&cid=”+vdata.pages[b_p].cid+”&avid=”+vdata.aid;
}
var response;
GM_xmlhttpRequest({
url: jsonlink,
method: “GET”,
onload: function(res) {
try {
response = JSON.parse(res.responseText);
} catch (e) {
response = false;
}
var data=false;
if (response){
data = response.data;
}else{
console.log(“data false”);
}
if (data) {
if (data.accept_quality[0]==data.quality){
jsontag.href=data.durl[0].url;
jsontag.innerText=data.accept_description[0];
}
} else {
jsontag.href=jsonlink;
console.log(“get false”);
}
}
});
jsontag.style.display.margin=”1em 1em”;
jsontag.style.display.color=”#23ade5″;
jsontag.target=”_self”;
infobar.append(jsontag,infobar.lastChild);
},2000);
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/99099.html