// ==UserScript== // @name 哔哩哔哩去除 6 分钟限制及 APP 下载 // @namespace http://tampermonkey.net/ // @version 0.4.2 // @description 去除手机版 6 分钟限制,添加网页跳转 // @author sl00p // @match https://m.bilibili.com/video/* // @grant none // @run-at document-end // @downloadURL none // ==/UserScript== (function() { 'use strict'; var host = "https://comment.bilibili.com/recommendnew,"; var aid = /\d+/g.exec(document.location.href)[0]; var relate = "https://api.bilibili.com/x/web-interface/archive/related?aid=" + aid; var zone = "https://api.bilibili.com/x/web-interface/ranking/region?rid="; console.log("start parse...."); (function() { if(window.localStorage && window.localStorage.getItem("window.bsource") != "wechat") { window.localStorage.setItem("window.bsource", "wechat"); } if(document.cookie.indexOf("wechat") == -1) { document.cookie = "bsource=wechat"; } })(); console.log("window.bsource ==> ", window.localStorage.getItem("window.bsource")); function HttpGet(url,success){ var xmlhttp = null; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } xmlhttp.open("GET",url,true); xmlhttp.timeout = 4000; xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4) { if (xmlhttp.status == 504 ) { console.log("服务器请求超时.."); xmlhttp.abort(); }else if(xmlhttp.status == 200){ success(xmlhttp.responseText); } xmlhttp = null; } } xmlhttp.ontimeout = function () { console.log("客户端请求超时.."); } xmlhttp.send(); } HttpGet(host + aid, function(res) { var data = JSON.parse(res).data; var nodesInterval = setInterval(function() { var nodes = document.getElementsByClassName("index__title__src-videoPage-related2Col-videoItem-"); if (nodes !== undefined) { for(var i = 0; i < nodes.length; ++i) { console.log("parse node " + i + " ..."); nodes[i].innerHTML="
"; // clearInterval(nodesInterval); }; } }, 1000); var appInterval = setInterval(function() { var nodeList = ["index__openAppBtn__src-commonComponent-topArea-", "index__svgaOpenAppBtn__src-videoPage-svgaOpenAppBtn-", "index__downLoadBtn__src-videoPage-commentArea-"]; var appList = ["index__openAppLabel__src-videoPage-related2Col-videoItem- index__pink__src-videoPage-related2Col-videoItem-", "index__openApp__src-videoPage-related2Col-videoItem-"]; for(var i = 0; i < appList.length; ++i) { var app = document.getElementsByClassName(appList[i]); if (app !== undefined) { app.onclick = function() { return false }; for(var j = 0; j < app.length; ++j) { app[j].innerText = data[j].owner.name; } for(var k = 0; k < nodeList.length; ++k) { if(document.getElementsByClassName(nodeList[k]).length > 0) { document.getElementsByClassName(nodeList[k])[0].remove(); } } // clearInterval(appInterval); } } }, 1000); }); (function() { HttpGet(relate, function(res) { var data = JSON.parse(res).data; var tidMap = {}; for(var i = 0; i < data.length; ++i) { if(tidMap.hasOwnProperty(data[i].tid)) { tidMap[data[i].tid] += 1; } else { tidMap[data[i].tid] = 1; } } for(var tid in tidMap) { HttpGet(zone + tid + "&day=7", function(res) { var data = JSON.parse(res).data; var relInterval = setInterval(function() { var relate_video = document.getElementsByClassName("index__title__src-videoPage-player-"); var app = document.getElementsByClassName("index__button__src-videoPage-player-"); if(relate_video !== undefined && relate_video.length > 0) { for(var i = 0; i < data.length; ++i) { if(relate_video[0].textContent === data[i].title) { relate_video[0].innerHTML=""; if(app !== undefined && app.length > 0) { app[0].innerText = data[i].author; } } } } }, 500); }); } }); })(); })();